process_check.sh

#!/bin/bash
# ========================================================
# Objet : verification de l'etat d'un process
# Auteur : E.Fougere
# Cree le : 15/05/2012
# =======================================================
w_process=$1
echo Process : $w_process
#v_res=`grep "${w_process}:" | wc -l`
v_res=`ps -ef |grep ${w_process} | grep -v grep | wc -l`
v_res=`expr ${v_res}`
#echo $v_res
if [ ${v_res} -eq 0 ]
then
 echo "==================================================================================="
 echo "ERREUR : Process [${w_process}] inexistant !"
 echo "==================================================================================="
 exit 1
fi
if [ ${v_res} -ne 0 ]
then
 echo "==================================================================================="
 echo "PAS d'ERREUR : Process [${w_process}] existant "
 echo "==================================================================================="
 exit 0
fi

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *