简体   繁体   English

使用launchd(mac)每3天自动运行一次python脚本

[英]Run python script automatically every 3 days with launchd (mac)

I am trying to automatically run a python script every 3 days .我正在尝试每 3 天自动运行一次 python 脚本。

What I am trying to accomplish is that the script is scheduled for every 3 days and if at that time the computer is offline, the job should be run immediately with startup and then again at the next scheduled time.我要完成的是脚本每 3 天安排一次,如果当时计算机处于脱机状态,则应在启动时立即运行该作业,然后在下一个预定时间再次运行。 Launchd does not seem to permit this, at least not directly, if I am not mistaken.如果我没记错的话,Launchd 似乎不允许这样做,至少不允许这样做。

Do you know how to set this specific condition into a launchd script?您知道如何将此特定条件设置为启动脚本吗?

StartInterval seems not to be the correct solution. StartInterval似乎不是正确的解决方案。

<key>StartInterval</key>
<integer>600</integer>

Thank you in advance!先感谢您!

使用 shed 模块完成此任务,它是如何工作的: https ://docs.python.org/3/library/sched.html?adlt=strict&toWww=1&redig=61A9A3C2EE904C8390C83AFB4AF75D87

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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