setup.py 934 B

12345678910111213141516171819
  1. import subprocess
  2. import sys
  3. import setup_util
  4. def start(args, logfile, errfile):
  5. setup_util.replace_text("play1/conf/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")
  6. subprocess.check_call("play1 start --%prod", shell=True, cwd="play1", stderr=errfile, stdout=logfile)
  7. # subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True)
  8. # subprocess.check_call("play1 war -o $RESIN_HOME/webapps/play1 --exclude benchmark_config", shell=True, cwd="play1")
  9. # subprocess.check_call("$RESIN_HOME/bin/resinctl start", shell=True)
  10. return 0
  11. def stop(logfile, errfile):
  12. try:
  13. subprocess.check_call("play1 stop", shell=True, cwd="play1", stderr=errfile, stdout=logfile)
  14. # subprocess.check_call("$RESIN_HOME/bin/resinctl shutdown", shell=True)
  15. # subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True)
  16. return 0
  17. except subprocess.CalledProcessError:
  18. return 1