cron - crontab + notify-send + Ubuntu 16.04 - Ask Ubuntu


this question has answer here:

in ubuntu 16.04 , 64 bit os, tried following

* * * * * export display=:0.0 && notify-send hey "how you" 

and

* * * * * export display=:0.0 && /usr/bin/notify-send hey "how you" 

but, unfortunately, not working.

i found in other threads above command works.

how run on machine?

the command notify-send hey "how you" works on terminal.

also command * * * * * echo "trying notify @ $(date)" >> /home/user/desktop/test.txt works fine crontab file

the output of $ echo $display :0

also

$ -u cosmicraga   tty7         2016-11-07 06:45 06:12        2524 (:0) cosmicraga   pts/1        2016-11-07 12:54   .          6333 (:0) cosmicraga   pts/17       2016-11-07 12:50 00:02        6333 (:0) 

create notify.sh file in home directory.

#!/usr/bin/env bash  username=$(/usr/bin/whoami) pid=$(pgrep -u $username nautilus) dbus=$(grep -z dbus_session_bus_address /proc/$pid/environ | sed 's/dbus_session_bus_address=//' ) export dbus_session_bus_address=$dbus  /usr/bin/notify-send "how you" 

in crontab :

* * * * *  display=0:0 /bin/sh /home/yourusername/notify.sh 

Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User

sql server - "Configuration file does not exist", Event ID 274 - Super User