Check Jenkins Status Get Email When Service Goes Down -
i know if there way periodically check status of jenkins service , email when service goes down?
on linux:
can use ps -ef | grep -v grep | grep jenkins | wc -l
find if jenkins running or not , if not try invoke email script or restart , put in crontab.
#!/bin/bash if (($(ps - ef | grep - v grep | grep $service | wc - l) > 0)) echo "$service running!!!" else echo "do stuff!!" fi
source / example : link
on localhost, can check http code url assuming jenkins running on 8080
#!/bin/bash response=$(curl --write-out %{http_code} --silent --output /dev/null http://localhost:8080) if [ $response == 200 ] echo "site up" else echo "site down" echo "do stuff!!" fi
on windows:
you can simillar form batch script using:
sc query service | findstr /i running | if "%errorlevel%"=="0" (sc stop service) else (sc start service)
more links read on
- stop , start service via batch or cmd file?
- batch file check if system service running
- http://www.geekstogo.com/forum/topic/207306-start-and-stop-services-in-a-single-batch-file/
other options:
- if using monitoring service nagios can monitor jenkins service too.
Comments
Post a Comment