setup_erlang.py 996 B

123456789101112131415161718192021
  1. import subprocess
  2. import sys
  3. import setup_util
  4. def start(args, logfile, errfile):
  5. setup_util.replace_text("cowboy/src/hello_world_app.erl", "\"benchmarkdbpass\", \".*\", 3306", "\"benchmarkdbpass\", \"" + args.database_host + "\", 3306")
  6. try:
  7. subprocess.check_call("rm -rf deps/*", shell=True, cwd="cowboy", stderr=errfile, stdout=logfile)
  8. subprocess.check_call("$IROOT/rebar/rebar get-deps", shell=True, cwd="cowboy", stderr=errfile, stdout=logfile)
  9. subprocess.check_call("$IROOT/rebar/rebar compile", shell=True, cwd="cowboy", stderr=errfile, stdout=logfile)
  10. subprocess.check_call("erl -pa ebin deps/*/ebin +sbwt very_long +swt very_low -s hello_world -noshell -detached", shell=True, cwd="cowboy", stderr=errfile, stdout=logfile)
  11. return 0
  12. except subprocess.CalledProcessError:
  13. return 1
  14. def stop(logfile, errfile):
  15. try:
  16. subprocess.check_call("killall beam.smp", shell=True, cwd="/usr/bin")
  17. return 0
  18. except subprocess.CalledProcessError:
  19. return 1