setup.py 652 B

12345678910111213141516
  1. import subprocess
  2. import sys
  3. import setup_util
  4. import os
  5. def start(args, logfile, errfile):
  6. setup_util.replace_text("openresty/nginx.conf", "CWD", os.getcwd())
  7. setup_util.replace_text("openresty/app.lua", "DBHOSTNAME", args.database_host)
  8. subprocess.Popen('sudo /usr/local/openresty/nginx/sbin/nginx -c `pwd`/nginx.conf -g "worker_processes ' + str((args.max_threads)) + ';"', shell=True, cwd="openresty", stderr=errfile, stdout=logfile)
  9. return 0
  10. def stop(logfile, errfile):
  11. subprocess.Popen('sudo /usr/local/openresty/nginx/sbin/nginx -c `pwd`/nginx.conf -s stop', shell=True, cwd="openresty", stderr=errfile, stdout=logfile)
  12. return 0