Skip to content
Snippets Groups Projects
Commit 519debc3 authored by sveseli's avatar sveseli
Browse files

fix group ownership in postgres scripts

parent 8ae113ab
No related branches found
No related tags found
No related merge requests found
...@@ -72,6 +72,8 @@ PGROOT=$DM_SUPPORT_DIR/postgresql/$DM_HOST_ARCH ...@@ -72,6 +72,8 @@ PGROOT=$DM_SUPPORT_DIR/postgresql/$DM_HOST_ARCH
PGENGINE=$PGROOT/bin PGENGINE=$PGROOT/bin
#PGUSER=dm #PGUSER=dm
PGUSER=`whoami` PGUSER=`whoami`
PGGROUPID=`id $PGUSER | cut -f1`
PGGROUP=`getent group $PGGROUPID | cut -d: -f1`
PGPORT=11136 # 111-DM PGPORT=11136 # 111-DM
PGDATA=$PGROOT/data PGDATA=$PGROOT/data
...@@ -82,9 +84,9 @@ PGSTARTUPLOG=$PGLOGDIR/postgresql ...@@ -82,9 +84,9 @@ PGSTARTUPLOG=$PGLOGDIR/postgresql
PGPIDFILE=$PGRUNDIR/postmaster.pid PGPIDFILE=$PGRUNDIR/postmaster.pid
PGLOCKFILE=$PGRUNDIR/postmaster.lock PGLOCKFILE=$PGRUNDIR/postmaster.lock
mkdir -p $PGDATA && chown -R $PGUSER:$PGUSER $PGDATA mkdir -p $PGDATA && chown -R $PGUSER:$PGGROUP $PGDATA
mkdir -p $PGRUNDIR && chown -R $PGUSER:$PGUSER $PGRUNDIR mkdir -p $PGRUNDIR && chown -R $PGUSER:$PGGROUP $PGRUNDIR
mkdir -p $PGLOGDIR && chown -R $PGUSER:$PGUSER $PGLOGDIR mkdir -p $PGLOGDIR && chown -R $PGUSER:$PGGROUP $PGLOGDIR
export PGDATA export PGDATA
export PGPORT export PGPORT
...@@ -104,7 +106,7 @@ start() { ...@@ -104,7 +106,7 @@ start() {
# Make sure startup-time log file is valid # Make sure startup-time log file is valid
if [ ! -e "$PGSTARTUPLOG" -a ! -h "$PGSTARTUPLOG" ]; then if [ ! -e "$PGSTARTUPLOG" -a ! -h "$PGSTARTUPLOG" ]; then
touch "$PGSTARTUPLOG" || exit 1 touch "$PGSTARTUPLOG" || exit 1
chown $PGUSER:$PGUSER "$PGSTARTUPLOG" chown $PGUSER:$PGGROUP "$PGSTARTUPLOG"
chmod go-rwx "$PGSTARTUPLOG" chmod go-rwx "$PGSTARTUPLOG"
[ -x /sbin/restorecon ] && /sbin/restorecon "$PGSTARTUPLOG" [ -x /sbin/restorecon ] && /sbin/restorecon "$PGSTARTUPLOG"
fi fi
...@@ -191,7 +193,7 @@ initdb() { ...@@ -191,7 +193,7 @@ initdb() {
echo -n $"Initializing database: " echo -n $"Initializing database: "
if [ ! -e "$PGDATA" -a ! -h "$PGDATA" ]; then if [ ! -e "$PGDATA" -a ! -h "$PGDATA" ]; then
mkdir -p "$PGDATA" || exit 1 mkdir -p "$PGDATA" || exit 1
chown $PGUSER:$PGUSER "$PGDATA" chown $PGUSER:$PGGROUP "$PGDATA"
chmod go-rwx "$PGDATA" chmod go-rwx "$PGDATA"
fi fi
...@@ -201,7 +203,7 @@ initdb() { ...@@ -201,7 +203,7 @@ initdb() {
# Make sure the startup-time log file is OK, too # Make sure the startup-time log file is OK, too
if [ ! -e "$PGSTARTUPLOG" -a ! -h "$PGSTARTUPLOG" ]; then if [ ! -e "$PGSTARTUPLOG" -a ! -h "$PGSTARTUPLOG" ]; then
touch "$PGSTARTUPLOG" || exit 1 touch "$PGSTARTUPLOG" || exit 1
chown $PGUSER:$PGUSER "$PGSTARTUPLOG" chown $PGUSER:$PGGROUP "$PGSTARTUPLOG"
chmod go-rwx "$PGSTARTUPLOG" chmod go-rwx "$PGSTARTUPLOG"
[ -x /sbin/restorecon ] && /sbin/restorecon "$PGSTARTUPLOG" [ -x /sbin/restorecon ] && /sbin/restorecon "$PGSTARTUPLOG"
fi fi
...@@ -212,7 +214,7 @@ initdb() { ...@@ -212,7 +214,7 @@ initdb() {
# Create directory for postmaster log # Create directory for postmaster log
mkdir -p "$PGDATA/pg_log" mkdir -p "$PGDATA/pg_log"
chown $PGUSER:$PGUSER "$PGDATA/pg_log" chown $PGUSER:$PGGROUP "$PGDATA/pg_log"
chmod go-rwx "$PGDATA/pg_log" chmod go-rwx "$PGDATA/pg_log"
if [ -f "$PGDATA/PG_VERSION" ]; then if [ -f "$PGDATA/PG_VERSION" ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment