Skip to content

Instantly share code, notes, and snippets.

@dev4dev
Created April 17, 2011 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dev4dev/924248 to your computer and use it in GitHub Desktop.
Save dev4dev/924248 to your computer and use it in GitHub Desktop.
start/stop postgres
#!/usr/local/bin/ruby
if !File.exist?('/usr/local/var/postgres/postmaster.pid') && ARGV[0] == 'start'
p %x[pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start]
p 'PG Started'
end
if File.exist?('/usr/local/var/postgres/postmaster.pid') && ARGV[0] == 'stop'
%x[pg_ctl -D /usr/local/var/postgres stop -s -m fast]
p 'PG Stopped'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment