diff options
Diffstat (limited to 'extra/postgresql/postgresql')
-rwxr-xr-x | extra/postgresql/postgresql | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/extra/postgresql/postgresql b/extra/postgresql/postgresql index 3a8bf44f8..0fbe94036 100755 --- a/extra/postgresql/postgresql +++ b/extra/postgresql/postgresql @@ -9,26 +9,26 @@ PGROOT=${PGROOT:-/var/lib/postgres} PG_CTL="/usr/bin/pg_ctl -D $PGROOT/data -l /var/log/postgresql.log -s -w" postgres_init() { - # initialization - if [ ! -d $PGROOT/data ]; then - mkdir -p $PGROOT/data && chown -R postgres:postgres $PGROOT - su - postgres -c "/usr/bin/initdb $INITOPTS -D $PGROOT/data" - fi - if [ ! -e /var/log/postgresql.log ]; then - touch /var/log/postgresql.log - chown postgres /var/log/postgresql.log - fi + # initialization + if [ ! -d $PGROOT/data ]; then + mkdir -p $PGROOT/data && chown -R postgres:postgres $PGROOT + su - postgres -c "/usr/bin/initdb $INITOPTS -D $PGROOT/data" + fi + if [ ! -e /var/log/postgresql.log ]; then + touch /var/log/postgresql.log + chown postgres /var/log/postgresql.log + fi } case "$1" in start) - postgres_init + postgres_init stat_busy "Starting PostgreSQL" su - postgres -c \ "$PG_CTL start" if [ $? -gt 0 ]; then stat_fail - exit 1 + exit 1 else add_daemon postgresql stat_done @@ -51,19 +51,19 @@ case "$1" in "$PG_CTL reload" if [ $? -gt 0 ]; then stat_fail - exit 1 + exit 1 else stat_done fi ;; restart) - postgres_init + postgres_init stat_busy "Restarting PostgreSQL" su - postgres -c \ "$PG_CTL restart -m fast" if [ $? -gt 0 ]; then stat_fail - exit 1 + exit 1 else add_daemon postgresql stat_done |