setup.py 507 B

12345678910111213141516171819202122232425
  1. import subprocess
  2. import os
  3. proc = None
  4. def start(args, logfile, errfile):
  5. global proc
  6. proc = subprocess.Popen(
  7. "exec $PY2_GUNICORN -c gunicorn_conf.py app:app",
  8. cwd="bottle", shell=True, stderr=errfile, stdout=logfile)
  9. return 0
  10. def stop(logfile, errfile):
  11. global proc
  12. if proc is None:
  13. return 0
  14. proc.terminate()
  15. proc.wait()
  16. proc = None
  17. subprocess.call("sudo pkill gunicorn", shell=True, stderr=errfile, stdout=logfile)
  18. return 0