How can I implement some sort of alarm clock functionality for a Python program running on raspbmc?

StackOverflow https://stackoverflow.com/questions/19200052

I'm turning my raspberry pi running on raspbmc (based on Debian) into an alarm clock that turns my tv on, displays the weather and plays a predifined song at, you guessed it, a specific time. I currently have most of the functionality implemented with Python e.g.: storing the path to a file for the song and filling in the wake-up time via a simple web interface.

I'm wondering what the best way (least intensive) is to run the wake-up routine at a specific time entered by me and, of course, change it when a new time is entered.

Hope you guys can help me out. Thanks!

有帮助吗?

解决方案

Just set up a cron task and set up a python script to perform the actions you need when triggered by cron.

Try:

% crontab -e

add a line:

10 7 * * 1-5 /path/to/your/script

Save & exit.

This should run your script at 7:10 Monday-Friday

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top