Last active
April 8, 2016 12:52
-
-
Save farhaven/71683fdfa78efc4ea1832c3ec80da6e3 to your computer and use it in GitHub Desktop.
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/ksh | |
echo "=> Setting up PostgreSQL..." | |
# | |
# Replace this currently running script by a shell running the same command, | |
# only as the user _postgresql | |
# | |
# -c : Run the rest of the commandline as if it were entered in there | |
# $@ : complete commandline passed to the script, including its name | |
if [ `whoami` == "root" ]; then | |
exec su -l -s /bin/sh _postgresql -c "/bin/sh -c $0 $@" | |
fi | |
mkdir /var/postgresql/data/ | |
initdb -D /var/postgresql/data -U postgres -E UTF8 -A md5 -W | |
echo "=> PostgreSQL setup complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment