Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 711
  • Last Modified:

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
0
msibley
Asked:
msibley
1 Solution
 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now