Cron with notify-send

前端 未结 13 1228
我寻月下人不归
我寻月下人不归 2020-12-09 10:06

I need to show a notification from a cron job. My crontab is something like:

$ crontab -l
# m h  dom mon dow   command
  * *   *   *   *    Display=:0.0 /usr         


        
13条回答
  •  借酒劲吻你
    2020-12-09 10:25

    Similar to nmax above, I also solved the issue by setting DBUS_SESSION_BUS_ADDRESS environment variable. However, I am using a combination of Linux Mint 19 (xfce4) and XMonad and for some reason, I don't have the process xfce4-session running. Instead, I found that xfce4-terminal is (usually) running, which resulted in the following line in the beginning of my script:

    eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME xfce4-terminal)/environ)"
    

    This resolved the issue for me.

提交回复
热议问题