]> git.pld-linux.org Git - packages/postgresql.git/blobdiff - postgresql.init
- adapterized, remaining pl translations, BuildRequires: automake
[packages/postgresql.git] / postgresql.init
index 8b9bcf2116f09a6411688a95cc1144ed297833f9..75f7b6f233faa94e2a41ced26aed2521586f9fa1 100644 (file)
@@ -32,6 +32,21 @@ if is_no "${NETWORKING}"; then
        exit 1
 fi
 
+# check if postmaster is realy alive
+if [ -f /var/lib/pgsql/postmaster.pid ]; then
+ if ps -p `head -1 /var/lib/pgsql/postmaster.pid` > /dev/null ; then
+        #ok. it's alive
+       echo > /dev/null;
+ else
+        # oh, it has crashed
+        rm -f  /var/lock/subsys/postgresql
+ fi
+else
+       # it's stoped. 
+       rm -f  /var/lock/subsys/postgresql
+fi
+
+
 # See how we were called.
 case "$1" in
   start)
@@ -56,7 +71,7 @@ case "$1" in
                        chown postgres.postgres $POSTGRES_DATA_DIR
                        chmod 700 $POSTGRES_DATA_DIR
                    fi
-                   su postgres -c "LD_LIBRARY_PATH=/usr/lib \
+                   TMPDIR=/tmp su postgres -c "LD_LIBRARY_PATH=/usr/lib \
                        initdb --pgdata=$POSTGRES_DATA_DIR \
                        -L /usr/share/postgresql"
                fi
@@ -70,7 +85,7 @@ case "$1" in
                    $([ "$POSTGRES_DISABLE_FSYNC". = yes. ] && echo '-F') \
                    $([ "$ALLOW_TCP_CONNECTIONS". = yes. ] && echo '-i')";
 
-               su postgres -c "\
+               TMPDIR=/tmp su postgres -c "\
                        $(echo "/usr/bin/pg_ctl start $PGSQL_CMDLINE -l $POSTGRES_LOG") \
                        $([ "$POSTMASTER_OPTIONS". != . ] && echo "-o '$POSTMASTER_OPTIONS'") \
                        $(echo "2>&1 >/dev/null")";
@@ -94,7 +109,7 @@ case "$1" in
        msg_stopping postgreSQL
        busy
        PGSQL_CMDLINE="$([ -n "$POSTGRES_DATA_DIR" ] && echo "-D $POSTGRES_DATA_DIR")";
-       su postgres -c "/usr/bin/pg_ctl stop $PGSQL_CMDLINE -m fast 2>&1 >/dev/null"
+       TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl stop $PGSQL_CMDLINE -m fast 2>&1 >/dev/null"
        out=`status postmaster`
        if [ $? -eq 0 ]; then
                deltext; fail
@@ -108,9 +123,13 @@ case "$1" in
        ;;
   status)
        PGSQL_CMDLINE="$([ -n "$POSTGRES_DATA_DIR" ] && echo "-D $POSTGRES_DATA_DIR")";
-       su postgres -c "/usr/bin/pg_ctl status $PGSQL_CMDLINE"
+       TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl status $PGSQL_CMDLINE"
+       ;;
+  restart)
+       $0 stop
+       $0 start
        ;;
-  restart|reload)
+  reload)
        if [ ! -f /var/lock/subsys/postgresql ]; then
                msg_Not_Running PostgreSQL
                exit 0  
@@ -125,7 +144,7 @@ case "$1" in
            $([ "$POSTGRES_DISABLE_FSYNC". = yes. ] && echo '-F') \
            $([ "$ALLOW_TCP_CONNECTIONS". = yes. ] && echo '-i')";
 
-       su postgres -c "\
+       TMPDIR=/tmp su postgres -c "\
                $(echo "/usr/bin/pg_ctl restart $PGSQL_CMDLINE -l $POSTGRES_LOG") \
                $([ "$POSTMASTER_OPTIONS". != . ] && echo "-o '$POSTMASTER_OPTIONS'") \
                $(echo "2>&1 >/dev/null")";
This page took 0.044129 seconds and 4 git commands to generate.