From 888ec81cc2cfd05a2ac5af25b4dba6d0571f0564 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sun, 10 Sep 2017 22:37:31 +0000 Subject: [PATCH] Cloud9 automatically start postgres and redis --- webapp/run_c9.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webapp/run_c9.py b/webapp/run_c9.py index c934894..22eff1b 100644 --- a/webapp/run_c9.py +++ b/webapp/run_c9.py @@ -1,6 +1,11 @@ from run import app, socketio, init_debug import os +import subprocess if __name__ == "__main__": + running = subprocess.check_output(['ps', '-A']) + if "postgres" not in str(running): + subprocess.call("sudo service postgresql start", shell=True) + subprocess.call("sudo service redis-server start", shell=True) init_debug() socketio.run(app, host=os.getenv('IP', '0.0.0.0'), port=int(os.getenv('PORT', 8080)), debug=True) \ No newline at end of file