I have a fairly light script that I want to run periodically in the background every 5 hours or so. The script runs through a few different websites, scans them for new material, and either grabs .mp3 files from them or likes songs on youtube based on their content. There are a few things I want to achieve with this program that I am unsure of how to attain:
If your script doesn't need to be constantly in execution, and it sounds like it doesn't, I'd suggest you set up a cron job.
On a typical Linux box, you can edit your
crontab file via:
$ crontab -e
This will open your crontab in your standard editor and install the crontab file for you after you're done (i.e. you save it)
A typical crontab command looks like:
# m h dom mon dow command 15 0 * * * /bin/bash /home/yourself/bin/dump_my_tables.sh
this line will execute
dump_my_tables.sh every day at 00:15. Your script will need a like like the following:
0 */5 * * * /usr/bin/python /home/yourself/bin/scrape_the_web.py
cronversions don't accept
*/5syntax, you have to manually specify the hours when you want the script to be scheduled, i.e.