exhoosier10
exhoosier10

Reputation: 121

Methods to schedule a task prior to runtime

What are the best methods to set a .py file to run at one specific time in the future? Ideally, its like to do everything within a single script.

Details: I often travel for business so I built a program to automatically check me in to my flights 24 hours prior to takeoff so I can board earlier. I currently am editing my script to input my confirmation number and then setting up cron jobs to run said script at the specified time. Is there a better way to do this?

Options I know of:

• current method

• put code in the script to delay until x time. Run the script immediately after booking the flight and it would stay open until the specified time, then check me in and close. This would prevent me from shutting down my computer, though, and my machine is prone to overheating.

Ideal method: input my confirmation number & flight date, run the script, have it set up whatever cron automatically, be done with it. I want to make sure whatever method I use doesn't include keeping a script open and running in the background.

Upvotes: 3

Views: 59

Answers (1)

twalberg
twalberg

Reputation: 62469

cron is best for jobs that you want to repeat periodically. For one-time jobs, use at or batch.

Upvotes: 2

Related Questions