-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
54 lines (36 loc) · 966 Bytes
/
run.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
54
#! /usr/bin/python
# -*- coding: utf-8 -*-
import sys
import run_springboot_jar_service
import os
def run():
if (len(sys.argv)) > 1:
app = sys.argv[1]
run_app(app)
def run_app(app):
if app == "lock-platform":
run_jar()
else:
run_springboot_jar_service.run(app)
# def copyfile(src, dst):
# shutil.copyfile(src, dst)
# def getcwd():
# return os.path.split(os.path.realpath(__file__))[0]
def run_jar():
copy_to_app_dir()
os.system('systemctl daemon-reload')
os.system('systemctl restart app.service')
# def run_war():
# print 'run war......'
# run_tomcat.run()
# def is_jar_or_war():
# if os.path.exists('/opt/app/app.jar'):
# return 'jar'
# else:
# return 'war'
def copy_to_app_dir():
os.system('rm -rf /opt/app/*')
os.system('cp /opt/*.jar /opt/app/app.jar')
os.system('cp /opt/*.war /opt/app/ROOT.war')
if __name__ == '__main__':
run()