【发布时间】:2020-06-01 14:40:51
【问题描述】:
我希望有人可以帮助我,我正在尝试使用 crontab 运行一些自动 python 脚本,并且它可以工作,但由于某种原因它不会按预期运行脚本。 如果我长时间不建立 SSH 连接,crontab 中的 python 脚本将无法运行,如果我再次登录,它们将在我注销后运行一段时间然后停止。
30 03 * * * systemctl reboot > /home/ajorge/server/python/logs/crontab_reboot.log 2>&1
45 03 * * * sudo python /home/ajorge/server/python/startup.py > /home/ajorge/server/python/logs/crontab_startup.log 2>&1
*/15 * * * * sudo python /home/ajorge/server/python/backup_auth.py > /home/ajorge/server/python/logs/crontab_auth.log 2>&1
*/15 * * * * sudo python /home/ajorge/server/python/backup_characters.py > /home/ajorge/server/python/logs/crontab_characters.log 2>&1
35 03 * * * sudo python /home/ajorge/server/python/backup_world.py > /home/ajorge/server/python/logs/crontab_world.log 2>&1
*/15 * * * * sudo python /home/ajorge/server/python/backup_clean.py > /home/ajorge/server/python/logs/crontab_clean.log 2>&1
对于下面的示例,脚本假设每 15 分钟运行一次,但我们可以看到它没有运行,并且存在间隙
如果我与服务器建立 SSH 连接,它将再次开始运行脚本,而无需我做任何事情。
谁能帮帮我?
【问题讨论】: