-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartsober.py
executable file
·42 lines (31 loc) · 956 Bytes
/
startsober.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
#!/usr/bin/env python2.6
import os
import sys
import pwd
import time
import signal
import subprocess
import setproctitle
sys.path.append( "%s/core/lib" % (os.getcwd()) )
sys.path.append( "%s/programs" % (os.getcwd()) )
sys.path.append( "%s/modules" % (os.getcwd()) )
import sober.exception
import sober.config
programs = ['enqueuer-in', 'enqueuer-out', 'scanner','policyd','webservice']
procs = []
config = sober.config.Config()
cfg = config.get_config()
sober_path = cfg.get('core', 'sober_path')
try:
if os.getuid() != 0:
raise sober.exception.NonRootException('this program must to be started as root')
setproctitle.setproctitle('sober')
for prog in programs:
procs.append(subprocess.Popen(['python', sober_path, '-p', prog]))
while True:
time.sleep(10)
except KeyboardInterrupt:
for proc in procs:
print 'exiting.. ', proc.pid
proc.kill()
sys.exit(0)