Skip to content

Instantly share code, notes, and snippets.

@sgargel
Created February 4, 2022 10:51
Show Gist options
  • Save sgargel/e99ec8966c161545fd8eb5973683144d to your computer and use it in GitHub Desktop.
Save sgargel/e99ec8966c161545fd8eb5973683144d to your computer and use it in GitHub Desktop.
Oracle DB SQL Ping
SQLCONN="user/pass@//db_ip:db_port/service_name"
while true ; do OUT=$(echo "SELECT /*json*/ * FROM DUAL;" | sql -s $SQLCONN 2>&1) ; echo $OUT | jq -e '(.results[].items[].dummy == "X")' && (echo -e '\a'; echo "$(date) PONG" ; sleep 1) || (echo "$(date) : $OUT"; sleep 5); done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment