21

It might be very simple question, but how could I run a python script on my fedora dist every 2 days?

Thanks

Antonis

7
  • 8
    What 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? Commented Dec 16, 2010 at 11:28
  • 3
    S.Lott, I think he wanted a quick solution. Not sure, if these kind of questions should be encouraged. Commented 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 right Commented Dec 16, 2010 at 11:38
  • 1
    possible duplicate of Creating a Cron Job - Linux / Python Commented Dec 16, 2010 at 12:09
  • @S.Lott to his problem, - 'How to do this task' kind? Commented Dec 16, 2010 at 12:18

1 Answer 1

66

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

Sign up to request clarification or add additional context in comments.

2 Comments

+w is writable, you probably meant +x. And pretty sure you should set a minute and hour. 0 0 for example.
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.