setup_pypy.py 517 B

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