Created
March 14, 2012 14:45
-
-
Save lstoll/2036964 to your computer and use it in GitHub Desktop.
Simple script to run an app local postgres instance
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 | |
PORT=5556 | |
DB=gsv | |
if [ ! -d "db" ]; then | |
sudo sysctl -w kern.sysv.shmall=65536 | |
sudo sysctl -w kern.sysv.shmmax=16777216 | |
mkdir db | |
initdb db | |
postgres -D db -p $PORT & | |
PGPID=$! | |
while [ ! -S "/tmp/.s.PGSQL.${PORT}" ] | |
do | |
sleep 0.5 | |
done | |
createdb -p $PORT $DB | |
else | |
postgres -D db -p $PORT & | |
PGPID=$! | |
fi | |
wait $PGPID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment