简体   繁体   中英

Is time.sleep a good way to run a python script every day?

I would like to run a python script every day in my EC2 Linux instance. My idea is to run my python script with time.sleep() at the end and detach the screen using screen Linux command. Is there a more efficient way to do this?

If you're looking to run a command at a specific time each day take a look at crontab . By using this you can set a schedule for when the script should run.

If you do have any output for the script then make sure that you pipe it to a log file.

You can use a cron job to execute your script at a given time. Take a look at a guide here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM