From 99bacd9979367c5de3ae54d665b23677b2cba477 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Fri, 15 Mar 2019 16:27:42 +0100 Subject: [PATCH] Improve debug mode --- check_pg_streaming_replication | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/check_pg_streaming_replication b/check_pg_streaming_replication index cdab14e..99369e6 100755 --- a/check_pg_streaming_replication +++ b/check_pg_streaming_replication @@ -115,13 +115,15 @@ id "$PG_USER" > /dev/null 2>&1 [ -z "$PG_DB" ] && PG_DB="$PG_USER" function psql_get () { - echo "$1"|su - $PG_USER -c "$PSQL_BIN -d "$PG_DB" -t -P format=unaligned" + 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" } function debug() { if [ $DEBUG -eq 1 ] then - echo "[DEBUG] $1" + >&2 echo "[DEBUG] $1" fi }