Skip to content

Instantly share code, notes, and snippets.

@dev4dev dev4dev/Postgres
Created Apr 17, 2011

Embed
What would you like to do?
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
You can’t perform that action at this time.