run_unicorn.py 600 B

12345678910111213141516
  1. import helper
  2. from helper import Command
  3. import os
  4. def start(args, logfile, errfile):
  5. helper.set_database_host(args)
  6. commands = [
  7. Command("sudo /usr/local/nginx/sbin/nginx -c $TROOT/config/nginx.conf", True),
  8. Command("rvm ruby-2.0.0-p0 do bundle exec unicorn -E production -c config/unicorn.rb", False)
  9. ]
  10. return helper.run(commands, logfile, errfile, args.troot)
  11. def stop(logfile, errfile):
  12. helper.run([Command("sudo /usr/local/nginx/sbin/nginx -s stop -c $TROOT/config/nginx.conf", True)], logfile, errfile, os.environ['TROOT'])
  13. return helper.stop('unicorn', logfile, errfile)