Thursday, November 17, 2011

Creating sound and visual alarm in ubuntu using cronjob

I needed some sort of alarm every 30 min to get me out of my deep unhealthy focus so i can have some rest, so i created the below commands in crontab to do the following functionalities

1- Play a notification sound
2- Shows a notification message at the top-right section of the screen for 2 seconds

crontab -e

0,30 * * * * play /usr/share/sounds/ubuntu/stereo/message-new-instant.ogg;
0,30 * * * * export DISPLAY=:0; export XAUTHORITY=~/.Xauthority; notify-send -t 2000 "30 Minutes passed."

CTRL-O
Enter
CTRL-X


No comments:

Post a Comment