-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregularmission.py
53 lines (48 loc) · 1.77 KB
/
regularmission.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import time
import os
from apscheduler.schedulers.blocking import BlockingScheduler
utc = 0
# draw all the plot in the waitlist file
def regular():
# copy waitlistmission to onging
os.system('cp sysreport/waitlistmission.sh sysreport/ongingmission.sh')
# delete expired waitlist
os.system('rm sysreport/waitlistmission.sh')
# create new waitlist file for further mission
f = open('sysreport/waitlistmission.sh', 'w+')
f.close()
# execute the latest onging mission
os.system('sh sysreport/ongingmission.sh')
# determine whether there are new waitlist plots
def isnewmission():
f = open('/root/airchina/status.txt') # Read waitlist mission
line = f.readline()
if line != '':
f.close()
return False
f.close()
# f = open('/root/qxahz/stations.txt')
f = open('sysreport/waitlistmission.sh') # Read waitlist mission
line = f.readline()
if line != '':
f.close()
return True
f.close()
return False
# copy latest prduct to HOME model
def copyfile():
os.system('rm -rf /root/station_forecast/website/static/images/model/GFS')
os.system('cp -r product/ /root/station_forecast/website/static/images/model/GFS')
os.system('rm -rf /home/model/GFS')
os.system('cp -r product/ /home/model/GFS')
# main program to update all plots to the latest
print('[' + time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time() + utc * 60 * 60)) + ']' + '\tPlot System Start')
while True:
if isnewmission():
print('[' + time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(time.time() + utc * 60 * 60)) + ']' + '\tPlot Cycle Start')
regular()
copyfile()
else:
print('NO new mission or onging mission is in place...')
time.sleep(60)