Created
January 15, 2015 06:27
-
-
Save roniemicro/892fab3d7823a0c1fd05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true | |
do | |
if nc -w 2 server2 9999 < /dev/null > /dev/null 2>&1 | |
then | |
# Service is currently running | |
[ "$PREV" = "NOT" ] && /path/to/your/script | |
PREV="RUNNING" | |
else | |
# Service 2 is not running on server2 | |
PREV="NOT" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment