- avoid regenerating yum metadata if no packages are newer than the
[myplc.git] / plc.d / postgresql
index bd5ca7a..c16f152 100755 (executable)
@@ -7,7 +7,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: postgresql,v 1.6 2006/10/27 20:29:20 mlhuang Exp $
+# $Id: postgresql,v 1.9 2007/01/19 16:42:08 mlhuang Exp $
 #
 
 # Source function library and configuration
@@ -94,9 +94,11 @@ case "$1" in
        PLC_API_IP=$(gethostbyname $PLC_API_HOST)
        PLC_WWW_IP=$(gethostbyname $PLC_WWW_HOST)
        (
+           echo "host $PLC_DB_NAME $PLC_DB_USER 127.0.0.1/32 password"
            echo "host $PLC_DB_NAME $PLC_DB_USER $PLC_API_IP/32 password"
            echo "host $PLC_DB_NAME $PLC_DB_USER $PLC_WWW_IP/32 password"
            # Drupal also uses PostgreSQL
+           echo "host drupal $PLC_DB_USER 127.0.0.1/32 password"
            echo "host drupal $PLC_DB_USER $PLC_WWW_IP/32 password"
        ) >>$pghba_conf
 
@@ -147,7 +149,9 @@ case "$1" in
 
        # Shut down the server
        service postgresql stop
-       check
+
+       # /etc/init.d/postgresql fails if it is not running
+       [ "$PLC_DB_ENABLED" = 1 ] && check
 
        result "$MESSAGE"
        ;;