LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   cron script to verify application is running? (https://www.linuxquestions.org/questions/linux-general-1/cron-script-to-verify-application-is-running-38998/)

Llwyd 12-20-2002 05:56 PM

cron script to verify application is running?
 
Is there a built in device to verify an application is running, and if it is not running, to spit out an error to syslog or better yet restart it? I have a business critical app that dropped on me the other night and didn't run over the weekend.

If there isn't a built in device can anyone point me in the right direction on how I would go about scripting something like this?

Thanks in advance,

L

acid_kewpie 12-20-2002 06:13 PM

is something as basic as
Code:

if [ `pidof -s applicationnamehere` ]
then
  echo application is running already
else
  echo application not found, loading now
  applicationnamehere
fi

suitable?

Llwyd 12-20-2002 06:41 PM

Hmm, thanks for the input, but I just stopped the app and ran the check and it still said it was running.

unSpawn 12-20-2002 06:49 PM

Lookup "monit" at Freshmeat. It can do different kind of checks, pids, ports, sockets.

Llwyd 12-20-2002 06:52 PM

Quote:

Originally posted by unSpawn
Lookup "monit" at Freshmeat. It can do different kind of checks, pids, ports, sockets.
Looks perfect, thanks man.


All times are GMT -5. The time now is 05:08 PM.