I really read many tutorials, but crontab doesn't start notify send.
What I've tried:
etc/crontabadded at the end:
15 * * * * notify-send 'crontab' 'test'with crontab interface:
crontab -eadded at the end:
15 * * * * notify-send 'crontab' 'test'
I really read many tutorials, but crontab doesn't start notify send.
What I've tried:
etc/crontab
added at the end:
15 * * * * notify-send 'crontab' 'test'
with crontab interface:
crontab -e
added at the end:
15 * * * * notify-send 'crontab' 'test'
As suggested by @Lnux:
Create a .sh, for example test.sh:
#!/bin/sh
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";
#Code:
DISPLAY=:0 notify-send "Test"
Then set up crontab:
crontab -e
And at the bottom, add:
* * * * * /home/myUser/test.sh
Obs.: you can place your .sh file in another location and don't forget to allow executing it.
eval ... with: eval "export | egrep 'DBUS_SESSION_BUS_ADDRESS|DISPLAY'".
– pdoherty926
Nov 09 '17 at 15:10
eval ... with the line suggested by @pdoherty926 and I got this output. declare -x DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1002/bus" declare -x DISPLAY=":1" . So I changed the next line to DISPLAY=:1 notify-send "Test". Still no notification with crontab
– kksagar
Jul 29 '21 at 09:12
Crontab is running in the background and without specified graphical output it will show nothing. So you should spicify, which output would you like to use. To achieve that, put export DISPLAY=:0 && before you command, e.g.
15 * * * * export DISPLAY=:0 && notify-send 'I am alive!'
crontab -e using user and root and nothing happens...
– Vitor Abella
Oct 08 '16 at 07:14
echo $DISPLAY in an xshell, to see to what it is set on your system. However, on Xubuntu-20.04 it didn't work, but export XDG_RUNTIME_DIR=/run/user/1000; notify-send -u critical TEST displaytest worked, while I'm the only desktop user, and my UID is 1000, which is the default for all xyUbuntus so far. You may as well evaluate the UID at runtime.
– user unknown
Apr 08 '21 at 13:47
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";– d a i s y Oct 08 '16 at 07:23notify-send 'crontab' 'test'? – Vitor Abella Oct 08 '16 at 07:4416.04this one worked – Midhun KM Jul 08 '18 at 05:56* * * * * export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ) && DISPLAY=:0 notify-send "Foo bar"– Saeed Falsafin Dec 21 '18 at 15:03