Created
January 29, 2013 19:38
-
-
Save phinze/4667015 to your computer and use it in GitHub Desktop.
In memory postgres database. First cut. Adapted from https://github.com/okfn/ckan/blob/master/bin/osx-postgres-mem.sh
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/sh | |
## set up postgres (in this case 9.0 from macports | |
export PGCTL=/usr/local/bin/pg_ctl | |
export PGDATA=/Volumes/pgtmp/postgres | |
case $1 in | |
start) | |
## Make a RAM filesystem | |
diskutil erasevolume HFS+ "pgtmp" `hdiutil attach -nomount ram://1048576` | |
## start postgres | |
${PGCTL} -D ${PGDATA} init | |
${PGCTL} -D ${PGDATA} start | |
sleep 2; | |
;; | |
stop) | |
## stop postgres | |
${PGCTL} -D ${PGDATA} stop | |
## poof! | |
umount /Volumes/pgtmp | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment