From e2d730fce79084953c6c37b2623ee740d23c5618 Mon Sep 17 00:00:00 2001 From: Zachary Vance Date: Sun, 5 Feb 2017 02:41:40 -0800 Subject: [PATCH] Check that znc is running by checking for an open port --- cgi-bin/check-port? | 7 +++++++ cgi-bin/service.status.d/znc | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100755 cgi-bin/check-port? diff --git a/cgi-bin/check-port? b/cgi-bin/check-port? new file mode 100755 index 0000000..16f0bf6 --- /dev/null +++ b/cgi-bin/check-port? @@ -0,0 +1,7 @@ +[ $# != 2 ] && echo "Wrong number of arguments to $(basename $0)" && exit 0 +HOST="$1" +PORT="$2" + +STATUS="$(nmap "$HOST" -p "$PORT" -oN - | grep "$PORT" | grep -v "#")" +echo "$STATUS" +echo "$STATUS" | grep -q "open" diff --git a/cgi-bin/service.status.d/znc b/cgi-bin/service.status.d/znc index 64287f3..1df2966 100644 --- a/cgi-bin/service.status.d/znc +++ b/cgi-bin/service.status.d/znc @@ -1 +1 @@ -./supervisor-up? znc +./check-port? znc.za3k.com 10000 -- 2.47.3