File: //var/opt/OV/bin/instrumentation/check-cron.sh
#!/bin/bash
date=`date +%d%m%y%H%M`
prog_name=`basename ${0}`
dir_name=`dirname ${0}`
OPCMON=/opt/OV/bin/opcmon
mon_name=OS-LX-CronProcessMonitor-Level3
VERSION=`cat /proc/version`
if [[ "$VERSION" =~ "Red Hat" ]]
then
OS="Red Hat"
proc=crond
elif [[ "$VERSION" =~ "SUSE" ]]
then
OS=SuSE
proc=cron
elif [[ "$VERSION" =~ "Debian" ]]
then
OS=Debian
proc=cron
elif [[ "$VERSION" =~ "centos" ]]
then
OS=CentOS
proc=crond
elif [[ "$VERSION" =~ "Ubuntu" ]]
then
OS=Ubuntu
proc=cron
fi
CantidadDeProcesosCron=` ps -ef | grep -e "[ /]$proc" -e "[ /]$proc -.*" | grep -v grep | grep -v $prog_name | wc -l `
if [ $? != 0 ]
then
CantidadDeProcesosCron=0
fi
$OPCMON $mon_name=$CantidadDeProcesosCron -object $proc
exit 0