Skip to content

Instantly share code, notes, and snippets.

@ktechmidas
Created March 14, 2017 16:33
Show Gist options
  • Save ktechmidas/a71142affb96c3a0a113078499fc55f5 to your computer and use it in GitHub Desktop.
Save ktechmidas/a71142affb96c3a0a113078499fc55f5 to your computer and use it in GitHub Desktop.
import os
import time
def is_process_running(process_id):
try:
os.kill(5475, 0)
return True
except OSError:
return False
while is_process_running(5475):
print "still running"
time.sleep(10)
else:
ps = subprocess.Popen("/home/seafile/seafile-server-latest/seafile.sh start && /home/seafile/seafile-server-latest/seahub.sh start-fastcgi", shell=True, stdout=subprocess.PIPE)
output = ps.stdout.read()
ps.stdout.close()
ps.wait()
print "Stopped"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment