Getting notify-send to Work in Cron-Jobs and Over SSH on Linux Mint 17/18 Cinnamon


Add this little bit of code to your script:

if [ ! -v DBUS_SESSION_BUS_ADDRESS ]; then
  pid=$(pgrep -u $LOGNAME cinnamon-sessio)
  eval "export $(\grep -z DBUS_SESSION_BUS_ADDRESS /proc/$pid/environ)"
fi
export DISPLAY=:0
notify-send "Hello!"

Modified from one of the comments here (note the shortened “cinnamon-sessio” — that’s intentional!): http://askubuntu.com/questions/298608/notify-send-doesnt-work-from-crontab

I only added the export DISPLAY as that was required on older versions of notify-send.