Arquivo

Posts Tagged ‘check’

Process check script for Linux

Sometimes I need to keep checking the some process is running in my servers. So, I created the following script and add it to Crontab. If I have problems, Ill receive an email.
This can be useful to someone!
In my example, Im searching for a process called zookeeper.

#!/bin/bash
SERVER="PROD 134"
ZK=`ps aux | grep zookeeper | grep -v "grep" | wc -l`

if [ $ZK -ge 1 ]
   then
        echo "ZK is Running"
   else
        echo "ZK is not Running" | mail -s "Zookeeper is not running - $SERVER" myemail@br.ibm.com
fi
Categorias:Linux Tags:, , , ,