Browse Source

Modified setup file

Patrick Falls 12 years ago
parent
commit
427a5de8ee
1 changed files with 12 additions and 3 deletions
  1. 12 3
      php/setup.py

+ 12 - 3
php/setup.py

@@ -2,6 +2,7 @@
 import subprocess
 import subprocess
 import sys
 import sys
 import setup_util
 import setup_util
+import os
 from os.path import expanduser
 from os.path import expanduser
 
 
 home = expanduser("~")
 home = expanduser("~")
@@ -17,7 +18,7 @@ def start(args):
     #subprocess.check_call("sudo a2ensite php", shell=True)
     #subprocess.check_call("sudo a2ensite php", shell=True)
     #subprocess.check_call("sudo chown -R www-data:www-data php", shell=True)
     #subprocess.check_call("sudo chown -R www-data:www-data php", shell=True)
     #subprocess.check_call("sudo /etc/init.d/apache2 start", shell=True)
     #subprocess.check_call("sudo /etc/init.d/apache2 start", shell=True)
-    subprocess.check_call("php-fpm --fpm-config config/php-fpm.conf", shell=True)
+    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf", shell=True)
     subprocess.check_call("sudo /usr/local/nginx/sbin nginx -c " + home + "FrameworkBenchmarks/php/deploy/nginx.conf", shell=True)
     subprocess.check_call("sudo /usr/local/nginx/sbin nginx -c " + home + "FrameworkBenchmarks/php/deploy/nginx.conf", shell=True)
     
     
     return 0
     return 0
@@ -26,8 +27,16 @@ def start(args):
 def stop():
 def stop():
   try:
   try:
     subprocess.check_call("sudo /usr/local/nginx/sbin nginx -s stop", shell=True)
     subprocess.check_call("sudo /usr/local/nginx/sbin nginx -s stop", shell=True)
-    subprocess.check_call("sudo /etc/init.d/apache2 stop", shell=True)
-    subprocess.check_call("sudo chown -R $USER:$USER php", shell=True)
+    p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
+    out, err = p.communicate()
+    for line in out.splitlines():
+      if 'php-fpm' in line:
+        try:
+          pid = int(line.split(None, 2)[1])
+          os.kill(pid, 9)
+        except OSError:
+          pass
+    
     return 0
     return 0
   except subprocess.CalledProcessError:
   except subprocess.CalledProcessError:
     return 1
     return 1