Check if coldfusion service running and send email

I'm having problems with an ubuntu 10.04 server running plesk 10.4.4 and coldfusion 8. Periodically the coldfusion service stops and plesk loses its path settings to CF. I need a script to run as a cron job every hour or so to check the service and email me if it isn't running.

Mark
msibleyAsked:
Who is Participating?
 
TobiasHolmCommented:
Hi!

Install package "mailutils" if you don't already have "mail" on your system. When you install it, you have to configure it to work on your system.

#!bin/bash
if pidof -x insertservicename > /dev/null; then
      echo "Service running"
else
      echo "Service stopped" | /usr/bin/mail -s "ALERT" "your@email.com"
fi

Open in new window


Ref: http://www.linuxquestions.org/questions/programming-9/bash-check-if-a-program-is-running-329962/
Ref: http://theos.in/shell-scripting/send-mail-bash-script/

Regards, Tobias
0
 
msibleyAuthor Commented:
That pretty much did the trick.

Thanks,

Mark
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.