setup_erlang.py 706 B

123456789101112131415161718192021
  1. import subprocess
  2. import sys
  3. import setup_util
  4. def start(args):
  5. setup_util.replace_text("elli/src/elli_bench_sup.erl", "\"benchmarkdbpass\", \".*\", 3306", "\"benchmarkdbpass\", \"" + args.database_host + "\", 3306")
  6. try:
  7. subprocess.check_call("./rebar get-deps", shell=True, cwd="elli")
  8. subprocess.check_call("./rebar compile", shell=True, cwd="elli")
  9. subprocess.check_call("erl -pa ebin deps/*/ebin -s elli_bench -noshell -detached", shell=True, cwd="elli")
  10. return 0
  11. except subprocess.CalledProcessError:
  12. return 1
  13. def stop():
  14. try:
  15. subprocess.check_call("killall beam.smp", shell=True, cwd="/usr/bin")
  16. return 0
  17. except subprocess.CalledProcessError:
  18. return 1