我实际上是在树莓派3上工作,没有互联网作为实习生。
首先,我创建了一个Python脚本,该脚本与Cron一起安排,以每12小时更新一次覆盆子小时。
其次,我有另一个脚本应连续运行。 但是我观察到,当我更新时间时,连续运行的脚本不会更新其日期时间。
因此,我想重新启动它,以使脚本可以考虑一些时间。 在这里,我想重新启动脚本。
from math import *
import pyorbital
from pyorbital import tlefile
from pyorbital.orbital import Orbital
import serial
import time
from datetime import datetime
import os
import sat_class
import predict
import rotator_treshold_test
def rotator_set (azel,v):
if v == False:
az = 0
el = 90
print(('waiting \n azimuth = %f elevation = %f\n\n')%(az,el))
else:
az = azel[0]
if azel[1] < 0:
el = 0
else :
el = azel[1]
print(('tracking satellite \n azimuth = %f elevation = %f\n\n')%(az,el))
def satellite_track():
k=0
saved = [0]
p = '?'
b = '?'
sat = sat_class.Satellite()
mission = predict.Mission()
verif = mission.verif
if verif == False:
mission = predict.Mission()
now= mission.now
print(now)
azel = [0,0] # we don't need to put azel here we are in waiting mode .
rotator_set(azel,verif)
time.sleep(29)
else :
mission= predict.Mission()
print("current time1: ",mission.now,'\n',mission.start,' ',mission.end)
verif1 = mission.verif
end = mission.end
now2 = mission.now
while now2 <= end :
azel = rotator_treshold_test.az_correct(saved[k])
rotator_set(azel,verif1)
saved.append(rotator_treshold_test.az_correct(azel[0]))
k+=1
mission = predict.Mission()
now2 = mission.now
print(now2)
time.sleep(0.8)
##I would like to reboot my script here
while True :
satellite_track()