How to set an hourly alarm?

You can use the below python script not only for setting an hourly alarm, but for setting an alarm with any time interval. Firstly create a new file alarm.py, using vi alarm.py . Then paste the following code in the file,

#!/usr/bin/env python2 import pynotify from pygame import mixer from time import sleep def sendmessage(title, message): pynotify.init("Test") notice = pynotify.Notification(title, message) notice.show() return while True: mixer.init() #you must initialize the mixer alert=mixer.Sound('beep.wav') #name of the sound file is beep.wav alert.play() sendmessage("ALARM!!", "1 hour up!") sleep(3600)

Here, beep.wav is the name of the sound file which should also be in the same directory as of the alarm.py file (preferably home folder). You can download any beep sound file of your choice from the internet.

Now make the file executable by,

chmod +x alarm.py

Now to run this in background,

nohup /home/'username'/alarm.py &

(this is when alarm.py is in the home folder, use the appropriate file address as required)

and hit Enter twice. Now this process will be running in background, if you want to stop this, type,

ps ax| grep alarm.py 

and type,

kill process_id

Currently, the time interval is 1 hour. If you want to change it, change the line sleep(3600) to sleep(no_of_seconds) [IN this case, 3600 = 60*60 seconds = 1 hour.]

Hope it helped!


Sounds like an App request to me Kaustubh or at least a feature request for alarm-clock. In the meantime if you don't understand cron you can use the gnome-schedule application to give you a gui way of adding your reminders.

sudo apt-get install gnome-schedule

Keyboard preferences has a typing break monitor that can be triggered hourly. Doesn't trigger if you have breaks in your work.

If it doesn't fit your needs it may be a good starting point to develop your own alarm.