|
1 |
| - |
2 | 1 | import subprocess
|
3 | 2 | import sys
|
4 | 3 | import setup_util
|
5 | 4 | from os.path import expanduser
|
6 | 5 |
|
7 | 6 | home = expanduser("~")
|
8 | 7 |
|
9 |
| -def start(args): |
| 8 | +def start(args, logfile, errfile): |
10 | 9 | setup_util.replace_text("php-zend-framework/config/benchmarks.local.php", "mysql:dbname=hello_world;host=localhost", "mysql:dbname=hello_world;host=" + args.database_host)
|
11 | 10 | setup_util.replace_text("php-zend-framework/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
|
12 | 11 |
|
13 | 12 | try:
|
14 |
| - subprocess.check_call("composer.phar install --optimize-autoloader", shell=True, cwd="php-zend-framework") |
15 |
| - subprocess.check_call("sudo chown -R www-data:www-data php-zend-framework", shell=True) |
16 |
| - subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-zend-framework/deploy/php-fpm.pid", shell=True) |
17 |
| - subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-zend-framework/deploy/nginx.conf", shell=True) |
| 13 | + subprocess.check_call("composer.phar install --optimize-autoloader", shell=True, cwd="php-zend-framework", stderr=errfile, stdout=logfile) |
| 14 | + subprocess.check_call("sudo chown -R www-data:www-data php-zend-framework", shell=True, stderr=errfile, stdout=logfile) |
| 15 | + subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-zend-framework/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile) |
| 16 | + subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-zend-framework/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile) |
18 | 17 | return 0
|
19 | 18 | except subprocess.CalledProcessError:
|
20 | 19 | return 1
|
21 |
| -def stop(): |
| 20 | +def stop(logfile, errfile): |
22 | 21 | try:
|
23 |
| - subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True) |
24 |
| - subprocess.call("sudo kill -QUIT $( cat php-zend-framework/deploy/php-fpm.pid )", shell=True) |
25 |
| - subprocess.check_call("sudo chown -R $USER:$USER php-zend-framework", shell=True) |
| 22 | + subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile) |
| 23 | + subprocess.call("sudo kill -QUIT $( cat php-zend-framework/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile) |
| 24 | + subprocess.check_call("sudo chown -R $USER:$USER php-zend-framework", shell=True, stderr=errfile, stdout=logfile) |
26 | 25 | return 0
|
27 | 26 | except subprocess.CalledProcessError:
|
28 | 27 | return 1
|
0 commit comments