-
Notifications
You must be signed in to change notification settings - Fork 0
/
process.py
29 lines (24 loc) · 1.01 KB
/
process.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
import os
import time
utc = 0
def createsh():
f = open('/root/GFS/sysreport/running.txt', 'w+')
f.write('[' + time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(time.time() + utc * 60 * 60)) + ']' + '\tSystem start.\n')
f.close()
print('[' + time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(time.time() + utc * 60 * 60)) + ']' + 'Write script file...\n')
f = open('/root/GFS/process.sh', 'w+')
f.write(
'python3 main.py\npython3 productinitialize_WTP.py\npython3 productinitialize_WGP.py\n')
f.close()
def start():
print('[' + time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(time.time() + utc * 60 * 60)) + ']' + 'Start script.\n')
f = open('/root/GFS/sysreport/running.txt', 'a+')
f.write(
'[' + time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time() + utc * 60 * 60)) + ']' + '\tStart running script.\n')
f.close()
os.system('sh process.sh')
createsh()
start()