Created
June 14, 2011 10:26
-
-
Save jezdez/1024647 to your computer and use it in GitHub Desktop.
A script to start a Homebrew postgres in memory (needs lunchy to automatically stop the global postgres instance, gem install lunchy)
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/bash | |
# get lunchy: gem install lunchy | |
lunchy stop postgres | |
# Run this script to enable the Ramdisk for Postgres | |
VolumeName="postgres-memory" | |
# Size in MB, make sure is not too low or not too high | |
SizeInMB=2048 | |
NumSectors=$((2*1024*SizeInMB)) | |
DeviceName=`hdid -nomount ram://$NumSectors` | |
VolumePath="/Volumes/$VolumeName" | |
echo $DeviceName | |
diskutil eraseVolume HFS+ $VolumeName $DeviceName | |
cp -R /usr/local/var/postgres $VolumePath/postgres | |
chown -R $USER:admin $VolumePath/postgres | |
/usr/local/bin/postgres -D $VolumePath/postgres | |
umount $VolumePath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment