diff options
Diffstat (limited to 'postgresql.init')
-rw-r--r-- | postgresql.init | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/postgresql.init b/postgresql.init index f273ac5..6eb80f5 100644 --- a/postgresql.init +++ b/postgresql.init @@ -132,7 +132,7 @@ start(){ touch "$PGLOG" || exit 1 chown postgres:postgres "$PGLOG" chmod go-rwx "$PGLOG" - [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$PGLOG" 2>/dev/null + [ -x /sbin/restorecon ] && /sbin/restorecon "$PGLOG" fi # Check for the PGDATA structure @@ -243,8 +243,19 @@ initdb(){ fi # Clean up SELinux tagging for PGDATA [ -x /sbin/restorecon ] && /sbin/restorecon "$PGDATA" + + # Make sure the startup-time log file is OK, too + if [ ! -e "$PGLOG" -a ! -h "$PGLOG" ] + then + touch "$PGLOG" || exit 1 + chown postgres:postgres "$PGLOG" + chmod go-rwx "$PGLOG" + [ -x /sbin/restorecon ] && /sbin/restorecon "$PGLOG" + fi + # Initialize the database $SU -l postgres -c "$PGENGINE/initdb --pgdata='$PGDATA' --auth='ident'" >> "$PGLOG" 2>&1 < /dev/null + # Create directory for postmaster log mkdir "$PGDATA/pg_log" chown postgres:postgres "$PGDATA/pg_log" |