4

I've been looking around for a while for the best way to do this, but not really getting very far. I have a python script that is running several times a day on a cron, this script determines the times and dates that another script needs to be scheduled to run. The times, dates and durations that this script need to run on varies dramatically, and they are one-off events.

My problem is how to actually schedule these events. Can anyone advise a suitable python or linux method?

Thanks

UPDATE: Thanks chaps for the prompt.

For anyone else searching this, this is what I did, for script foobar.py to run at 9.15am on Jul 14th:

import subprocess
subprocess.Popen(['python foobar.py | at 9.15am Jul 14',], shell=True)
3
  • 1
    There's at for one-off scheduled jobs. Commented May 14, 2012 at 21:32
  • OP: I find it hard to believe that the POpen command you have works. Unless foobar.py outputs a bash script for at to run. Commented May 15, 2012 at 3:37
  • I think you may be correct Thanatos, I hadn't fully tested the solution when I updated. Can you suggest a way around this? Commented May 15, 2012 at 13:53

2 Answers 2

3

Use the at command from the python script. See the documentation here.

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

Comments

1
import time,sched;

I think sched is something you are looking for

Comments

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.