Untitled

 avatar
unknown
plain_text
2 years ago
539 B
6
Indexable
#!/bin/bash
host="localhost"
port=11400
webserver_status=0
scheduler_status=0
(echo > /dev/tcp/$host/$port) > /dev/null 2>&1
# using telenet command
if [ $? -eq 0 ]; then
  webserver_status=1
  echo "Up"
else
  webserver_status=0
  echo "Down"
fi
(echo > /dev/tcp/$host/$port) > /dev/null 2>&1
status=$?
# Check the exit code of the telnet command to see if the scheduler is up or down
if [ $status -eq 0 ]; then
  scheduler_status=1
  echo "Scheduler is Up"
else
  scheduler_status=0
  echo "Scheduler is Down"
fi
Editor is loading...