Skip to content

Instantly share code, notes, and snippets.

@jhancock
Created March 10, 2010 20:21
Show Gist options
  • Save jhancock/328329 to your computer and use it in GitHub Desktop.
Save jhancock/328329 to your computer and use it in GitHub Desktop.
class Nginx < Thor
desc "start", "start nginx"
def start
`sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf`
end
desc "stop", "stop nginx"
def stop
nginx_pid_path = "/usr/local/nginx/logs/nginx.pid"
# `cat #{nginx_pid_path}`
pid = run("cat #{nginx_pid_path}")
if pid.length == 0
say "no pid file at #{nginx_pid_path}", :red
else
# `sudo kill -QUIT #{pid}`
run("sudo kill -QUIT #{pid}")
say "nginx stopped", :white
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment