X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plc.d%2Fpostgresql;h=1139af441be40c33b4b5a5cbf89cfb120e0d7224;hb=9aecb8c6fde06136bef94e2fd6fce832dc3c0c10;hp=4f986e68983433f8e2a22c32b703652e19dcb24a;hpb=5ff0153f8eef9cff5cb1c84f17bc761a4ba56237;p=plcapi.git diff --git a/plc.d/postgresql b/plc.d/postgresql index 4f986e6..1139af4 100755 --- a/plc.d/postgresql +++ b/plc.d/postgresql @@ -51,7 +51,9 @@ case "$1" in MESSAGE=$"Starting PostgreSQL server" dialog "$MESSAGE" - ######## sysconfig + ######## sysconfig +# xxx on f16, the systemd init script won't read /etc/sysconfig/pgsql/postgresql any more +# need to find out how to perform this configuration, if still needed # Set data directory and redirect startup output to /var/log/pgsql mkdir -p $(dirname $postgresql_sysconfig) touch $postgresql_sysconfig @@ -70,8 +72,15 @@ case "$1" in # PostgreSQL must be started at least once to bootstrap # /var/lib/pgsql/data if [ ! -f $postgresql_conf ] ; then - service postgresql initdb &> /dev/null || : - check +# fedora 16 uses systemd +# http://docs.fedoraproject.org/en-US/Fedora/16/html/Release_Notes/sect-Release_Notes-Changes_for_Sysadmin.html + if type postgresql-setup >& /dev/null ; then + postgresql-setup initdb || : + check + else + service postgresql initdb &> /dev/null || postgresql : + check + fi fi ######## /var/lib/pgsql/data/postgresql.conf @@ -85,7 +94,7 @@ case "$1" in echo "timezone='UTC'" >> $postgresql_conf ######## /var/lib/pgsql/data/pg_hba.conf - # Disable access to all DBs from all hosts + # Disable access to MyPLC and drupal DBs from all hosts sed -i -e '/^\(host\|local\)/d' $pghba_conf # Enable passwordless localhost access @@ -143,7 +152,8 @@ case "$1" in if [ -z "$PLC_DB_PASSWORD" ] ; then PLC_DB_PASSWORD=$(uuidgen) plc-config --category=plc_db --variable=password --value="$PLC_DB_PASSWORD" --save=$local_config $local_config - service plc reload + #service plc reload + plc_reload force fi if ! psql -U $PLC_DB_USER -c "" template1 >/dev/null 2>&1 ; then psql -U postgres -c "CREATE USER $PLC_DB_USER PASSWORD '$PLC_DB_PASSWORD'" template1