Untitled
unknown
plain_text
2 years ago
1.0 kB
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 echo "$webserver_status" echo "$scheduler_status" if [$webserver_status -eq 0] && [$scheduler_status -eq 0]; then echo "both webserver and scheduler ae down...starting both webserver and scheduler" airflow webserver -D airflow scheduler -D fi if [$webserver_status -eq 1] && [$scheduler_status -eq 0]; then echo "scheduler is down" airflow scheduler -D fi if [$webserver_status -eq 0] && [$scheduler_status -eq 1]; then echo "webserver is down and scheduler is up" airflow webserver -D fi
Editor is loading...