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

other options:

  • if using monitoring service nagios can monitor jenkins service too.

sending mail python using smtp


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -