我想我想要的是直接的。
在 23 小时 59 分钟后重新启动我的 Raspberry Pi 的 Python 脚本。我尝试执行此操作而不是使用 cron 作业设置时间的原因是 Pi 没有用于时钟的板载电池,所以我不在乎时间是什么(如果连接到互联网,它将获取当前时间) ,距剧本开始仅倒计时23小时59分钟。
这是我所知道的;
def restart():
SendEmail = SendEmail "SYSTEM RESTART", "ncam.py auto restart initiated" msg['Subject'], body)
command = "/usr/bin/sudo /sbin/shutdown -r now"
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
output = process.communicate()[0]
Run Code Online (Sandbox Code Playgroud)
另外,我想向自己发送一封电子邮件,其中包含上述设置的参数。
raspberry-pi ×1