Created
May 27, 2016 20:23
-
-
Save andersonfraga/34b5048fd1aa0778e60bae223b43448d to your computer and use it in GitHub Desktop.
Execute notify-send via cronjob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# * * * * * /bin/sh cronjob.sh "Teste 1 2 3" | |
{ | |
PID=$(/usr/bin/pgrep gnome-session) | |
dbus=$(/bin/grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-) | |
export DBUS_SESSION_BUS_ADDRESS=$dbus | |
DISPLAY=:0.0 /usr/bin/notify-send --urgency=critical "Alert using crontab" "$1" | |
} >> $HOME/crontab/alert.log 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
O 'DISPLAY=:0.0' "garante" que funcione sempre. Sem ele, fica inconsistente