#!/bin/bash #Author Sudharsan #Designation devops #GNU General Public License node=node redis=redis-server /sbin/pidof $node > /dev/null if [ $? -eq 1 ] then echo "Node not running" | mail -s "$(hostname) Node not running" devops@expertus.com fi /sbin/pidof $redis > /dev/null if [ $? -eq 1 ] then echo "Redis not running" | mail -s "$(hostname) Redis not running" devops@expertus.com fi
login to root
crontab -e
* * * * * /bin/sh /home/expprodl/bin/node-monitor.sh