It might be very simple question, but how could I run a python script on my fedora dist every 2 days?
Thanks
Antonis
asked Dec 16, 2010 at 11:26
Antonis
1,0613 gold badges18 silver badges36 bronze badges
-
8What part of cron confuses you? Creating the schedule? Or running a Python script? What part of the cron man pages have you read? What have you tried? What errors are you getting? Can you be more specific on what help you need?S.Lott– S.Lott2010年12月16日 11:28:31 +00:00Commented Dec 16, 2010 at 11:28
-
3S.Lott, I think he wanted a quick solution. Not sure, if these kind of questions should be encouraged.Senthil Kumaran– Senthil Kumaran2010年12月16日 11:32:07 +00:00Commented Dec 16, 2010 at 11:32
-
Thank you anyway. I just needed a quick solution. I know should read the man pages and try different things. You are rightAntonis– Antonis2010年12月16日 11:38:49 +00:00Commented Dec 16, 2010 at 11:38
-
1possible duplicate of Creating a Cron Job - Linux / PythonS.Lott– S.Lott2010年12月16日 12:09:26 +00:00Commented Dec 16, 2010 at 12:09
-
@S.Lott to his problem, - 'How to do this task' kind?Senthil Kumaran– Senthil Kumaran2010年12月16日 12:18:14 +00:00Commented Dec 16, 2010 at 12:18
1 Answer 1
It is a question on cron. First is add a SHEBANG line on top of your python script.
#!/usr/bin/env python
Make your script executable with chmod +x
And do a crontab -e and add 0 0 */2 * * /path/to/your/pythonscript.py
answered Dec 16, 2010 at 11:31
Senthil Kumaran
57.3k15 gold badges99 silver badges139 bronze badges
Sign up to request clarification or add additional context in comments.
2 Comments
plundra
+w is writable, you probably meant +x. And pretty sure you should set a minute and hour. 0 0 for example.
Senthil Kumaran
Thanks for correcting those plundra. +w was typo and while most often I myself make the mistake of cron editing only to realize it soon and change it quickly.
lang-py