Created
January 4, 2016 17:30
-
-
Save mvdbeek/5024387ddc63df91c1ad to your computer and use it in GitHub Desktop.
example script for running postgresql controlled by supervisor on real bootable machines
This file contains 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/bash | |
# This script is run by Supervisor to start PostgreSQL 9.1 in foreground mode | |
function shutdown() | |
{ | |
echo "Shutting down PostgreSQL" | |
kill $(cat /var/lib/postgresql/9.3/main/postmaster.pid) | |
exit 0 | |
} | |
if [ -d /var/run/postgresql ]; then | |
chmod 2775 /var/run/postgresql | |
else | |
install -d -m 2775 -o postgres -g postgres /var/run/postgresql | |
fi | |
# Allow any signal which would kill a process to stop PostgreSQL | |
trap shutdown HUP INT QUIT ABRT KILL ALRM TERM TSTP | |
exec sudo -u postgres /usr/lib/postgresql/9.3/bin/postmaster -D /etc/postgresql/9.3/main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment