-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
34 lines (26 loc) · 953 Bytes
/
app.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
import subprocess
from flask import Flask, render_template, redirect
app = Flask(__name__)
@app.route('/jobs', methods=['POST', 'GET'])
def jobs():
return render_template('jobs.html')
@app.route('/start/<string:app>', methods=['GET', 'POST'])
def start(app):
command = "/usr/share/app-manager/start.sh -a %s -f start" % (app)
subprocess.call(command, shell=True)
print(command)
return redirect('/jobs')
@app.route('/stop/<string:app>', methods=['GET', 'POST'])
def stop(app):
command = "/usr/share/app-manager/start.sh -a %s -f stop" % (app)
subprocess.call(command, shell=True)
print(command)
return redirect('/jobs')
@app.route('/launch/<string:app>', methods=['GET', 'POST'])
def launch(app):
command = "/usr/share/app-manager/start.sh -a %s -f launch" % (app)
subprocess.call(command, shell=True)
print(command)
return redirect('/jobs')
if __name__ == "__main__":
app.run(debug=True)