Created
September 20, 2018 18:14
-
-
Save bsnyder/dd05ca7e3abcdd34d49166a732fb958e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sudo su - postgres -c '/opt/local/lib/postgresql96/bin/pg_ctl -D /opt/local/var/db/postgresql96/defaultdb -l /opt/local/var/log/postgresql96/postgres.log stop' | |
pg_version=$(psql --version | cut -d ' ' -f3) | |
if [ $? -eq 0 ]; then | |
echo "PostgreSQL $pg_version stopped successfully" | |
exit 0 | |
else | |
echo "PostgreSQL $pg_version did not stop in a timely fashion, please see /opt/local/var/log/postgresql96/postgres.log for details" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment