Skip to content

Instantly share code, notes, and snippets.

@lstoll
Created March 14, 2012 14:45
Show Gist options
  • Save lstoll/2036964 to your computer and use it in GitHub Desktop.
Save lstoll/2036964 to your computer and use it in GitHub Desktop.
Simple script to run an app local postgres instance
#!/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