Apollo
Apollo

Reputation: 9054

Run Python Script - Cron

How can I run a python script once at exactly 12:00PM on Wednesday (Jan 21)?

I've added #!/usr/bin/env python to the top of my script and made the script executable with chmod +x

I know I want to do something like crontab -e 0 0 * * * /path/to/my/pythonscript.py but I'm not exactly sure how to get it to be a specific time...

Upvotes: 0

Views: 150

Answers (1)

Geotob
Geotob

Reputation: 2945

To run on 21 Jan at 12pm you will need the following line in your crontab file: 0 12 21 1 * /path/to/my/pythonscript

Edit the crontab file with crontab -e

The first number is minute, the second number is hour, the third one day of month, the fourth month, the fifth is day of week (in this case a * for any day of week), then the path.

The wikipedia entry on Cron is really helpful if you want to change the times.

Upvotes: 1

Related Questions