I intend to do web-scraping of a particular website to get the data regularly. I want this python program to be run every day a couple of times automatically. Is it possible? If yes, how can I do it? Ubuntu is my OS
Asked
Active
Viewed 3,376 times
0
-
It is possible what OS are you running? – edhedges Mar 13 '14 at 14:34
-
how can i do it. my OS is ubuntu – user3415869 Mar 13 '14 at 14:35
-
2you could/should use `cron` – dm03514 Mar 13 '14 at 14:37
-
is there any problem in 17 19 * * * ~/Desktop python hello.py in cron? @dm03514 – user3415869 Mar 13 '14 at 15:21
1 Answers
2
You have options that I can think of. You could have your python code do it all like in this answer: https://stackoverflow.com/a/15090893/1165441
Or if you would like to set up a cron job and execute your script that way here are instructions for Ubuntu: https://help.ubuntu.com/community/CronHowto
In my opinion using a cron job is cleaner because of separations of concerns, but the quick and dirty way would work as well.
-
1
-
i am using this in cron but it wont work ? 17 19 * * * ~/Desktop python hello.py – user3415869 Mar 13 '14 at 15:21
-
@user3415869 I honestly haven't used cron in a while so I couldn't tell you without looking it up and you could do the same. – edhedges Mar 13 '14 at 15:55
-
its okay. i have one question. so the cron will be executing the program even my pc is turned off? – user3415869 Mar 13 '14 at 17:59
-
@user3415869 no. You can't execute code on a machine that is turned off. – edhedges Mar 13 '14 at 18:44