setup.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import subprocess
  2. import sys
  3. import time
  4. import os
  5. def start(args, logfile, errfile):
  6. if os.name == 'nt':
  7. subprocess.check_call('"..\\sbt\\sbt.bat" assembly', shell=True, cwd="curacao", stderr=errfile, stdout=logfile)
  8. else:
  9. subprocess.check_call("$FWROOT/sbt/sbt assembly", shell=True, cwd="curacao", stderr=errfile, stdout=logfile)
  10. subprocess.Popen("java -jar dist/curacao-standalone.jar", shell=True, cwd="curacao", stderr=errfile, stdout=logfile)
  11. time.sleep(5)
  12. return 0
  13. def stop(logfile, errfile):
  14. if os.name == 'nt':
  15. subprocess.check_call("wmic process where \"CommandLine LIKE '%curacao-standalone%'\" call terminate", stderr=errfile, stdout=logfile)
  16. else:
  17. p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  18. out, err = p.communicate()
  19. for line in out.splitlines():
  20. if 'curacao-standalone' in line:
  21. try:
  22. pid = int(line.split(None, 2)[1])
  23. os.kill(pid, 15)
  24. except OSError:
  25. pass
  26. return 0
  27. ##start([], open('log.out','a'), open('error.out','a'))
  28. ##stop(open('log.out','a'), open('error.out','a'))