-refactored pypo install and uninstall scripts into start/stop/install/uninstall scripts

This commit is contained in:
mkonecny 2010-12-17 14:15:53 -05:00
parent f37d977356
commit 1c16f6f9e7
4 changed files with 54 additions and 12 deletions

View file

@ -91,8 +91,6 @@ try:
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-fetch/log/run")
os.system("chmod -R 755 /etc/service/pypo-fetch")
os.system("chown -R pypo:pypo /etc/service/pypo-fetch")
time.sleep(1)
os.system("svc -t /etc/service/pypo-fetch")
print "Installing daemontool script pypo-push"
create_path("/etc/service/pypo-push")
@ -101,8 +99,6 @@ try:
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-push/log/run")
os.system("chmod -R 755 /etc/service/pypo-push")
os.system("chown -R pypo:pypo /etc/service/pypo-push")
time.sleep(1)
os.system("svc -t /etc/service/pypo-push")
print "Installing daemontool script pypo-liquidsoap"
os.system("svc -dk /etc/service/pypo-liquidsoap")
@ -113,10 +109,10 @@ try:
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-liquidsoap/log/run")
os.system("chmod -R 755 /etc/service/pypo-liquidsoap")
os.system("chown -R pypo:pypo /etc/service/pypo-liquidsoap")
time.sleep(1)
os.system("svc -u /etc/service/pypo-liquidsoap")
print "Waiting for processes to start..."
time.sleep(5)
os.system("python ./pypo-start.py")
time.sleep(2)
p = Popen('svstat /etc/service/pypo-fetch', shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)

View file

@ -0,0 +1,22 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
if os.geteuid() != 0:
print "Please run this as root."
sys.exit(1)
try:
print "Starting daemontool script pypo-fetch"
os.system("svc -t /etc/service/pypo-fetch")
print "Starting daemontool script pypo-push"
os.system("svc -t /etc/service/pypo-push")
print "Starting daemontool script pypo-liquidsoap"
os.system("svc -t /etc/service/pypo-liquidsoap")
except Exception, e:
print "exception:" + str(e)

22
pypo/install/pypo-stop.py Normal file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
if os.geteuid() != 0:
print "Please run this as root."
sys.exit(1)
try:
print "Stopping daemontool script pypo-fetch"
os.system("svc -dx /etc/service/pypo-fetch")
print "Stopping daemontool script pypo-push"
os.system("svc -dx /etc/service/pypo-push")
print "Stopping daemontool script pypo-liquidsoap"
os.system("svc -dx /etc/service/pypo-liquidsoap")
except Exception, e:
print "exception:" + str(e)

View file

@ -21,10 +21,15 @@ def remove_user(username):
print "Waiting for processes to close..."
time.sleep(5)
os.system("delgroup " + username)
os.system("deluser --remove-home " + username)
#pypo group appears to be deleted when removing user.
#os.system("delgroup " + username)
try:
os.system("python ./pypo-stop.py")
print "Removing log directories"
remove_path("/var/log/pypo")
@ -32,17 +37,14 @@ try:
remove_path(BASE_PATH)
print "Removing daemontool script pypo-fetch"
os.system("svc -dx /etc/service/pypo-fetch")
remove_path("rm -rf /etc/service/pypo-fetch")
print "Removing daemontool script pypo-push"
os.system("svc -dx /etc/service/pypo-push")
remove_path("rm -rf /etc/service/pypo-push")
print "Removing daemontool script pypo-liquidsoap"
os.system("svc -dx /etc/service/pypo-liquidsoap")
remove_path("rm -rf /etc/service/pypo-liquidsoap")
remove_user("pypo")
#remove_user("pypo")
except Exception, e:
print "exception:" + str(e)