Web script start() now starts the services! Derp

This commit is contained in:
Henrik Lissner 2013-03-09 00:18:59 -05:00
parent 159842acfc
commit 44327c7ea0

13
bin/web
View file

@ -10,7 +10,7 @@ WWW = "#{PREFIX}/dev/www"
SERVICES = { SERVICES = {
:php => { :php => {
:bin => `which php-fpm`.strip, :bin => `which php-fpm`.strip,
:opts => "-D -c '#{CONF}/php/php.ini' --fpm-config '#{CONF}/php/php-fpm.conf' --pid = '#{PID}/php-fpm-pid'", :opts => "-p '/usr/local/var' -c '#{CONF}/php/php.ini' --fpm-config '#{CONF}/php/php-fpm.conf' --pid '#{PID}/php-fpm-pid'",
:pid => "#{PID}/php-fpm.pid" :pid => "#{PID}/php-fpm.pid"
}, },
:nginx => { :nginx => {
@ -26,11 +26,10 @@ SERVICES = {
def start def start
SERVICES.each_pair do |key,opts| SERVICES.each_pair do |key,opts|
if File.exist?(opts[:pid]) if File.exist?(opts[:pid])
puts "[NOTICE] Stopping #{key} ..." puts "[WARNING] #{key} is already running."
`kill #{`cat #{opts[:pid]}`.strip}`
`rm #{opts[:pid]} >/dev/null 2>&1`
else else
puts "[WARNING] #{key} is not running." puts "[NOTICE] Starting #{key} ..."
`#{opts[:bin]} #{opts[:opts]}`
end end
end end
end end
@ -38,7 +37,7 @@ end
def stop def stop
SERVICES.each_pair do |key,opts| SERVICES.each_pair do |key,opts|
if File.exist?(opts[:pid]) if File.exist?(opts[:pid])
puts "[NOTICE] Stopping #{serv} ..." puts "[NOTICE] Stopping #{key} ..."
`kill #{`cat #{opts[:pid]}`.strip}` `kill #{`cat #{opts[:pid]}`.strip}`
`rm #{opts[:pid]} >/dev/null 2>&1` `rm #{opts[:pid]} >/dev/null 2>&1`
else else
@ -57,7 +56,7 @@ def chdir
if File.directory?(WWW) if File.directory?(WWW)
`rm -r #{WWW}` `rm -r #{WWW}`
end end
`ln -s "#{`pwd`.strip}" "#{WWW}"` `ln -sf "#{`pwd`.strip}" "#{WWW}"`
restart restart
end end