import os
import datetime
import time
reboot_weekday = 0
reboot_hour = 20
reboot_min = 42
def check():
if reboot_weekday == 0:
return 1
if (reboot_weekday > 7) or (reboot_weekday < 0) or \
(reboot_hour > 23) or (reboot_hour < 0) or \
(reboot_min > 59) or (reboot_min < 0):
print("error: Num error")
exit(1)
return 0
if __name__ == '__main__':
retvalue = check()
if retvalue == 0:
while True:
now_time = datetime.datetime.now()
if (now_time.hour == reboot_hour) and (now_time.minute == reboot_min) and \
(reboot_weekday == now_time.isoweekday()):
os.system('reboot')
time.sleep(30)
else:
while True:
now_time = datetime.datetime.now()
if (now_time.hour == reboot_hour) and (now_time.minute == reboot_min):
os.system('reboot')
time.sleep(30)
11-22
7156
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)