setup.py 722 B

123456789101112131415161718192021
  1. import subprocess
  2. import sys
  3. import setup_util
  4. import os
  5. def start(args, logfile, errfile):
  6. try:
  7. subprocess.check_call("mvn clean package", shell=True, cwd="grizzly-jersey", stderr=errfile, stdout=logfile)
  8. subprocess.Popen(("java -jar target/grizzly-jersey-example.jar -dbhost " + args.database_host).rsplit(" "), cwd="grizzly-jersey", stderr=errfile, stdout=logfile)
  9. return 0
  10. except subprocess.CalledProcessError:
  11. return 1
  12. def stop(logfile, errfile):
  13. p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  14. out, err = p.communicate()
  15. for line in out.splitlines():
  16. if 'grizzly-jersey' in line and 'jar' in line:
  17. pid = int(line.split(None, 2)[1])
  18. os.kill(pid, 15)
  19. return 0