Fix improper local *.conf loading and sudo problems
This commit is contained in:
parent
a57e94a912
commit
d1acc5cb91
17
bin/web
17
bin/web
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
require 'colorize'
|
if ENV['USER'] == "root"
|
||||||
|
puts "Must not be run as root!"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
# A start-script for my local webserver. Mac-only and requires Homebrew
|
# A start-script for my local webserver. Mac-only and requires Homebrew
|
||||||
|
|
||||||
|
@ -21,7 +24,7 @@ end
|
||||||
SERVICES = {}
|
SERVICES = {}
|
||||||
if cmd_exists("php-fpm")
|
if cmd_exists("php-fpm")
|
||||||
SERVICES[:php] = {
|
SERVICES[:php] = {
|
||||||
:bin => `which php-fpm`.strip,
|
:bin => "sudo #{`which php-fpm`.strip}",
|
||||||
:opts => "-p '/usr/local/var' -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"
|
||||||
}
|
}
|
||||||
|
@ -42,7 +45,7 @@ if cmd_exists("memcached")
|
||||||
end
|
end
|
||||||
if cmd_exists("mysql.server")
|
if cmd_exists("mysql.server")
|
||||||
SERVICES[:db] = {
|
SERVICES[:db] = {
|
||||||
:bin => "su #{`whoami`.strip} -c #{`which mysql.server`.strip} start",
|
:bin => "#{`which mysql.server`.strip} start",
|
||||||
:opts => "",
|
:opts => "",
|
||||||
:pid => "#{PREFIX}/var/mysql/#{`hostname`}.pid"
|
:pid => "#{PREFIX}/var/mysql/#{`hostname`}.pid"
|
||||||
}
|
}
|
||||||
|
@ -54,9 +57,9 @@ end
|
||||||
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 " * #{key} is already running".red
|
puts " * #{key} is already running"
|
||||||
else
|
else
|
||||||
puts " * Starting #{key}".green
|
puts " * Starting #{key}"
|
||||||
`#{opts[:bin]} #{opts[:opts]}`
|
`#{opts[:bin]} #{opts[:opts]}`
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -65,11 +68,11 @@ 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 " * Stopping #{key}".green
|
puts " * Stopping #{key}"
|
||||||
`sudo kill #{`cat #{opts[:pid]}`.strip}`
|
`sudo kill #{`cat #{opts[:pid]}`.strip}`
|
||||||
`sudo rm #{opts[:pid]} >/dev/null 2>&1`
|
`sudo rm #{opts[:pid]} >/dev/null 2>&1`
|
||||||
else
|
else
|
||||||
puts " * #{key} is not running".red
|
puts " * #{key} is not running"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -66,6 +66,6 @@ http {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include ~/.nginx/*.conf;
|
include /usr/local/etc/nginx/sites/*.conf;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue