#!/bin/bash #define status STATE_OK=0 STATE_WARNING=1 STATE_CRITICAL=2 sms_home=/home/appadmin/sms a=`ps -ef |grep -v grep |grep -c smssender` if [ $a -eq 0 ];then echo "CRITICAL - SMS service is not running!" exit $STATE_CRITICAL fi s1=`tail -n 100 $sms_home/sms.log |grep -c ERROR` t2=`date -d "-0 day" "+%s"` if [ -f /tmp/sms_status.log ];then t1=`cat /tmp/sms_status.log` else t1=`date -d "-365 day" "+%s"` fi let t=$t2-$t1 if [ $s1 -ne 0 ];then echo "CRITICAL - SMS service is running ERROR!" exit $STATE_CRITICAL else echo "OK - SMS service is Ok!" exit $STATE_OK fi