X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plc.d%2Fpostgresql;h=c3c37b11b931a276e9f3938bd38540f4bfd51656;hb=1fc3e4e55ffdf2204a39f2209395585b3c5ea1a6;hp=9191c4def7eed70eb05e97ad3cf51b5ee5893bfe;hpb=d099e4b4eeef3493a08125316a29c50f79aaf3f3;p=plcapi.git diff --git a/plc.d/postgresql b/plc.d/postgresql index 9191c4de..c3c37b11 100755 --- a/plc.d/postgresql +++ b/plc.d/postgresql @@ -20,7 +20,7 @@ set -x PGDATA=/var/lib/pgsql/data postgresql_conf=$PGDATA/postgresql.conf pghba_conf=$PGDATA/pg_hba.conf -postgresql_sysconfig=/etc/sysconfig/pgsql +postgresql_sysconfig=/etc/sysconfig/pgsql/postgresql # Export so that we do not have to specify -p to psql invocations export PGPORT=$PLC_DB_PORT @@ -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