Use sudo instead of su command to run command as postgres user
This commit is contained in:
parent
950e21be0e
commit
914e33d335
1 changed files with 4 additions and 4 deletions
|
@ -116,14 +116,14 @@ id "$PG_USER" > /dev/null 2>&1
|
||||||
|
|
||||||
function psql_get () {
|
function psql_get () {
|
||||||
sql="$1"
|
sql="$1"
|
||||||
debug "Exec 'echo \"$sql\"|su - $PG_USER -c \"$PSQL_BIN -d \"$PG_DB\" -w -t -P format=unaligned\""
|
debug "Exec 'echo \"$sql\"|sudo -u $PG_USER $PSQL_BIN -d \"$PG_DB\" -w -t -P format=unaligned"
|
||||||
echo "$sql"|su - $PG_USER -c "$PSQL_BIN -d "$PG_DB" -w -t -P format=unaligned"
|
echo "$sql"|sudo -u $PG_USER $PSQL_BIN -d "$PG_DB" -w -t -P format=unaligned
|
||||||
}
|
}
|
||||||
|
|
||||||
function psql_master_get () {
|
function psql_master_get () {
|
||||||
sql="$1"
|
sql="$1"
|
||||||
debug "Exec 'echo \"$sql\"|su - $PG_USER -c \"$PSQL_BIN -U $M_USER -h $M_HOST -w -p $M_PORT -d $PG_DB -t -P format=unaligned\""
|
debug "Exec 'echo \"$sql\"|sudo -u $PG_USER $PSQL_BIN -U $M_USER -h $M_HOST -w -p $M_PORT -d $PG_DB -t -P format=unaligned"
|
||||||
echo "$sql"|su - $PG_USER -c "$PSQL_BIN -U $M_USER -h $M_HOST -w -p $M_PORT -d $PG_DB -t -P format=unaligned"
|
echo "$sql"|sudo -u $PG_USER $PSQL_BIN -U $M_USER -h $M_HOST -w -p $M_PORT -d $PG_DB -t -P format=unaligned
|
||||||
}
|
}
|
||||||
|
|
||||||
function debug() {
|
function debug() {
|
||||||
|
|
Loading…
Reference in a new issue