setup.py 724 B

12345678910111213141516171819202122
  1. import subprocess
  2. import sys
  3. import setup_util
  4. def start(args):
  5. setup_util.replace_text("servlet/src/main/webapp/WEB-INF/resin-web.xml", "localhost", args.database_host)
  6. try:
  7. subprocess.check_call("mvn clean compile war:war", shell=True, cwd="servlet")
  8. subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True)
  9. subprocess.check_call("cp servlet/target/servlet.war $RESIN_HOME/webapps/", shell=True)
  10. subprocess.check_call("$RESIN_HOME/bin/resinctl start", shell=True)
  11. return 0
  12. except subprocess.CalledProcessError:
  13. return 1
  14. def stop():
  15. try:
  16. subprocess.check_call("$RESIN_HOME/bin/resinctl shutdown", shell=True)
  17. return 0
  18. except subprocess.CalledProcessError:
  19. return 1