我正在使用闹钟应用程序和闹钟小部件,但是我只能设置每周的频率。我想要一个每小时的闹钟,有没有办法实现这个?在谷歌上搜索并没有找到答案,AU(Ask Ubuntu)上也没有,似乎以前没有人问过这个问题。目前,我使用crontab每小时触发一个notify-send命令。还有其他的应用程序或方法吗?
谢谢。
谢谢。
cron
,你可以使用gnome-schedule应用程序,以图形界面的方式添加提醒事项。sudo apt-get install gnome-schedule
#!/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() #必须先初始化mixer
alert=mixer.Sound('beep.wav') #声音文件名为beep.wav
alert.play()
sendmessage("ALARM!!", "1 hour up!")
sleep(3600)
这里,beep.wav是声音文件的名称,它应该与alarm.py文件在同一个目录中(最好是主目录)。您可以从互联网上下载任何自己喜欢的蜂鸣声音文件。chmod +x alarm.py
nohup /home/'username'/alarm.py &
ps ax| grep alarm.py
和类型,
kill process_id