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
Only this works for me (Xubuntu)
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME xfce4-session)/environ)"; notify-send "hello world"
If you are in gnome enviroment, you need change xfce4-session
to gnome-session
refer: https://askubuntu.com/questions/298608/notify-send-doesnt-work-from-crontab