Displaying Desktop Notification w/ cron

Gentoo Linux needs to run a set of scheduled maintenance commands to keep the system up-to-date. I try to run them weekly, but I sometimes (or often) forget to do so. To remind myself, I decided to display some kind of system notification. Gentoo Linux comes with a command for that. It's called notify-send. This command can be configured to run weekly with cron (with a bit of extra commands and arguments). After playing with different options, following setting with cron finally worked for me.

Disclaimer:
The information in this site is the result of my researches on the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

# crontab -e # This command runds at 7am on Fridays 00 7 * * 5 export DISPLAY=:0.0 && export XAUTHORITY=/home/[user-name]/.Xauthority && /usr/bin/notify-send -t 0 'Maintenance' 'Run the maintenance commands'

Without the -t 0 option, the notification disappears within a certain time. This option will let the notification stays up until it's clicked.

Step for Maintaining Gentoo Server

That's all!
-gibb

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>