diff --git a/check_pg_streaming_replication b/check_pg_streaming_replication index ae746a3..d1927f8 100755 --- a/check_pg_streaming_replication +++ b/check_pg_streaming_replication @@ -116,14 +116,14 @@ id "$PG_USER" > /dev/null 2>&1 function psql_get () { sql="$1" - debug "Exec 'echo \"$sql\"|su - $PG_USER -c \"$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" + debug "Exec 'echo \"$sql\"|sudo -u $PG_USER $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 () { 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\"" - 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"|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() {