-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloader
executable file
·56 lines (46 loc) · 1.49 KB
/
loader
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
55
56
#!/usr/bin/python
import bottle, sys, daemon, os, subprocess
import web_server.server
import plugins.video.app_server
import plugins.video.decoder
from config import config
op = { 'run' : 'web' }
if 'web' in sys.argv:
op['run'] = 'web'
elif 'video' in sys.argv:
op['run'] = 'video'
elif 'decoder' in sys.argv:
op['run'] = 'decoder'
def runit():
print 'loading', op['run'], '...'
if op['run'] == 'web':
web_server.server.app.config.update(config)
web_server.server.init()
bottle.run(web_server.server.app, host = '0.0.0.0', port = config['PORT'])
if op['run'] == 'video':
plugins.video.app_server.app.config.update(config)
plugins.video.app_server.init()
bottle.run(plugins.video.app_server.app, host = '0.0.0.0', port = plugins.video.app_server.PORT)
if op['run'] == 'decoder':
plugins.video.decoder.CONFIG = config
plugins.video.decoder.init()
plugins.video.decoder.start()
if '-c' in sys.argv:
print 'flushall redis ?'
raw_input()
os.system('redis-cli flushall')
print 'delete '+config['CACHE']+'/* ?'
raw_input()
os.system('rm -rf '+config['CACHE']+'/*')
exit(0)
if '-k' in sys.argv:
os.system("ps aux | grep loader | grep -v grep | awk '{print $2}' | xargs kill")
exit(0)
if '-s' in sys.argv:
os.system("ps aux | grep loader | grep -v 'grep\\|-s'")
exit(0)
if '-d' in sys.argv:
with daemon.DaemonContext():
runit()
else:
runit()