cc-2055: switch to init-d
-fix daemon being able to start multiple times -make airtime-install shell script to call installers seperately -
This commit is contained in:
parent
5803635d50
commit
c05c2f1e28
5 changed files with 34 additions and 21 deletions
|
@ -2,12 +2,10 @@
|
|||
|
||||
USERID=pypo
|
||||
GROUPID=pypo
|
||||
ENABLE="false"
|
||||
NAME=Airtime
|
||||
ID=airtime
|
||||
|
||||
DAEMON=/usr/bin/airtime-pypo
|
||||
PIDFILE=/var/run/$ID.pid
|
||||
PIDFILE=/var/run/airtime.pid
|
||||
|
||||
start () {
|
||||
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
||||
|
@ -16,7 +14,7 @@ start () {
|
|||
stop () {
|
||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
||||
rm $PIDFILE
|
||||
rm -f $PIDFILE
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -174,12 +174,10 @@ try:
|
|||
"""
|
||||
|
||||
print "Waiting for processes to start..."
|
||||
os.system("service airtime-pypo start")
|
||||
Popen("service airtime-pypo start".split(" "))
|
||||
|
||||
print "sleeping"
|
||||
time.sleep(10)
|
||||
|
||||
p = Popen("/etc/init.d/airtime-pypo start", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
except Exception, e:
|
||||
print "exception:" + str(e)
|
||||
sys.exit(1)
|
||||
|
|
|
@ -109,6 +109,12 @@ if __name__ == '__main__':
|
|||
print '###########################################'
|
||||
|
||||
signal.signal(signal.SIGINT, keyboardInterruptHandler)
|
||||
|
||||
#import daemonize
|
||||
#daemonize.createDaemon()
|
||||
#open("airtime.pid", "w").write(str(os.getpid()) + "\n")
|
||||
#daemonize.drop_privileges("pypo", "pypo")
|
||||
|
||||
|
||||
# initialize
|
||||
g = Global()
|
||||
|
@ -127,11 +133,9 @@ if __name__ == '__main__':
|
|||
q = Queue()
|
||||
|
||||
pp = PypoPush(q)
|
||||
pp.daemon = True
|
||||
pp.start()
|
||||
|
||||
pf = PypoFetch(q)
|
||||
pf.daemon = True
|
||||
pf.start()
|
||||
|
||||
while True: time.sleep(3600)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue