X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=plc.d%2Fpostgresql;h=f4c20931254667044f0cb7b31f72808fbc659097;hb=06b5c1ecd4912e01d43372806cc29489c880317e;hp=43fc7aa262eb10374a4ab48bb5da4e70f1ee863b;hpb=1272d2b1edb174f75380a9c0470c65d18c1f818b;p=myplc.git diff --git a/plc.d/postgresql b/plc.d/postgresql index 43fc7aa..f4c2093 100755 --- a/plc.d/postgresql +++ b/plc.d/postgresql @@ -58,7 +58,7 @@ case "$1" in exit 0 fi - MESSAGE=$"Starting database server" + MESSAGE=$"Starting PostgreSQL server" dialog "$MESSAGE" # Set data directory and redirect startup output to /var/log/pgsql @@ -101,6 +101,27 @@ case "$1" in PLC_API_IP=$(gethostbyname $PLC_API_HOST) PLC_BOOT_IP=$(gethostbyname $PLC_BOOT_HOST) PLC_WWW_IP=$(gethostbyname $PLC_WWW_HOST) + ip_failure=0 + if [ -z "$PLC_API_IP" ] ; then + MESSAGE=$"PLC_API_IP is not set" + dialog "$MESSAGE" + ip_failure=1 + fi + if [ -z "$PLC_BOOT_IP" ] ; then + MESSAGE=$"PLC_BOOT_IP is not set" + dialog "$MESSAGE" + ip_failure=1 + fi + if [ -z "$PLC_WWW_IP" ] ; then + MESSAGE=$"PLC_WWW_IP is not set" + dialog "$MESSAGE" + ip_failure=1 + fi + if [ $ip_failure -eq 1 ] ; then + /bin/false + check + fi + ( 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" @@ -144,7 +165,7 @@ case "$1" in check if ! psql -U $PLC_DB_USER -c "" drupal >/dev/null 2>&1 ; then createdb -U postgres --encoding=UNICODE --owner=$PLC_DB_USER drupal - psql -U $PLC_DB_USER -f /var/www/html/database/database.pgsql drupal + psql -U $PLC_DB_USER -f /var/www/html/database/database.pgsql drupal fi check @@ -152,7 +173,7 @@ case "$1" in ;; stop) - MESSAGE=$"Stopping database server" + MESSAGE=$"Stopping PostgreSQL server" dialog "$MESSAGE" # Drop the current user in case the username changes