![](/img/trans.png)
[英]Is there a way to sleep certain chunks of python code similar to time.sleep() without sleeping the entire script
[英]Is time.sleep a good way to run a python script every day?
我想每天在我的 EC2 Linux 实例中运行 python 脚本。 我的想法是在最后运行带有 time.sleep time.sleep()
的 python 脚本,并使用screen
Linux 命令分离屏幕。 有没有更有效的方法来做到这一点?
如果您希望在每天的特定时间运行命令,请查看crontab 。 通过使用它,您可以设置脚本何时运行的时间表。
如果您确实有任何 output 用于脚本,请确保将 pipe 写入日志文件。
您可以使用 cron 作业在给定时间执行脚本。 看看这里的指南。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.