-refactored pypo install and uninstall scripts into start/stop/install/uninstall scripts
This commit is contained in:
parent
f37d977356
commit
1c16f6f9e7
4 changed files with 54 additions and 12 deletions
|
@ -91,8 +91,6 @@ try:
|
||||||
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-fetch/log/run")
|
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-fetch/log/run")
|
||||||
os.system("chmod -R 755 /etc/service/pypo-fetch")
|
os.system("chmod -R 755 /etc/service/pypo-fetch")
|
||||||
os.system("chown -R pypo:pypo /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"
|
print "Installing daemontool script pypo-push"
|
||||||
create_path("/etc/service/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")
|
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-push/log/run")
|
||||||
os.system("chmod -R 755 /etc/service/pypo-push")
|
os.system("chmod -R 755 /etc/service/pypo-push")
|
||||||
os.system("chown -R pypo:pypo /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"
|
print "Installing daemontool script pypo-liquidsoap"
|
||||||
os.system("svc -dk /etc/service/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")
|
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-liquidsoap/log/run")
|
||||||
os.system("chmod -R 755 /etc/service/pypo-liquidsoap")
|
os.system("chmod -R 755 /etc/service/pypo-liquidsoap")
|
||||||
os.system("chown -R pypo:pypo /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..."
|
print "Waiting for processes to start..."
|
||||||
|
time.sleep(5)
|
||||||
|
os.system("python ./pypo-start.py")
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
p = Popen('svstat /etc/service/pypo-fetch', shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
|
p = Popen('svstat /etc/service/pypo-fetch', shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
|
||||||
|
|
22
pypo/install/pypo-start.py
Normal file
22
pypo/install/pypo-start.py
Normal 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
22
pypo/install/pypo-stop.py
Normal 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)
|
|
@ -21,10 +21,15 @@ def remove_user(username):
|
||||||
print "Waiting for processes to close..."
|
print "Waiting for processes to close..."
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
|
os.system("delgroup " + username)
|
||||||
os.system("deluser --remove-home " + username)
|
os.system("deluser --remove-home " + username)
|
||||||
|
|
||||||
|
#pypo group appears to be deleted when removing user.
|
||||||
#os.system("delgroup " + username)
|
#os.system("delgroup " + username)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
os.system("python ./pypo-stop.py")
|
||||||
|
|
||||||
print "Removing log directories"
|
print "Removing log directories"
|
||||||
remove_path("/var/log/pypo")
|
remove_path("/var/log/pypo")
|
||||||
|
|
||||||
|
@ -32,17 +37,14 @@ try:
|
||||||
remove_path(BASE_PATH)
|
remove_path(BASE_PATH)
|
||||||
|
|
||||||
print "Removing daemontool script pypo-fetch"
|
print "Removing daemontool script pypo-fetch"
|
||||||
os.system("svc -dx /etc/service/pypo-fetch")
|
|
||||||
remove_path("rm -rf /etc/service/pypo-fetch")
|
remove_path("rm -rf /etc/service/pypo-fetch")
|
||||||
|
|
||||||
print "Removing daemontool script pypo-push"
|
print "Removing daemontool script pypo-push"
|
||||||
os.system("svc -dx /etc/service/pypo-push")
|
|
||||||
remove_path("rm -rf /etc/service/pypo-push")
|
remove_path("rm -rf /etc/service/pypo-push")
|
||||||
|
|
||||||
print "Removing daemontool script pypo-liquidsoap"
|
print "Removing daemontool script pypo-liquidsoap"
|
||||||
os.system("svc -dx /etc/service/pypo-liquidsoap")
|
|
||||||
remove_path("rm -rf /etc/service/pypo-liquidsoap")
|
remove_path("rm -rf /etc/service/pypo-liquidsoap")
|
||||||
|
|
||||||
remove_user("pypo")
|
#remove_user("pypo")
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print "exception:" + str(e)
|
print "exception:" + str(e)
|
Loading…
Add table
Add a link
Reference in a new issue