Reputation: 21
I've created a program which edits a .txt file. This .txt file is used as a source of data for our website. These data change every hour. So, how can I make the python program run automatically every hour? I'm just a beginner, sorry.
Upvotes: 2
Views: 6635
Reputation: 1334
On Windows you can use Task Scheduler. Unfortunately, it's not immediately obvious how to create a task that repeats with a time period since it is normally used to schedule things by a time of day, date, day of week, or system state. Here are the instructions to set up a periodic task.
Congrats! You can poke around the other settings to see things like how it will handle task failures and other things.
Hope this helps!
Upvotes: 1
Reputation: 1147
If its windows
For command-line usage, you can schedule with the at command. I'll add the schtasks command which is the replacement in newer MS OS.
If its unix base then you can use cron.
Upvotes: 4
Reputation: 4547
For Linux and Unix, use crontab command to schedule your Python script.
http://www.computerhope.com/unix/ucrontab.htm
For Windows, use "Scheduled Task"
Upvotes: 2
Reputation: 445
The best way is with a cron job - It is a unix system that is made for running scripts at certain times.
Check out http://en.wikipedia.org/wiki/Cron for more information. Hourly is a pretty easy one to set up.
This way, all your program does is the logic (updating the txt file), and you dont need to write the hourly code.
Upvotes: 0