Check if deamons are running


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Check if deamons are running
# 1  
Old 05-02-2002
Check if deamons are running

Does anyone know if there is a UNIX-tool available that constantly will check if (some specific) deamons are running and will notify (via email) if one has failed/stopped?
I searched the web, but so far didn't find anything.
# 2  
Old 05-02-2002
To mannually check the deamon what you can do is
type $ ps -ef | grep <daemon process name> if its running it will show the process with a pid. If its not you may try to
$ /etc/init.d/<daemon process name> [start|stop|restart]. This is only a mannual way instruction i never did a daemon process stop alarm thru mail. Perhaps some others might have some idea.
# 3  
Old 05-02-2002
Hammer & Screwdriver send an email if process fails

this can be done by writing a shell script
I have choosen to write this in korn shell
---------------------------------------------


#!/usr/bin/ksh

PROCESSCOUNT=$(ps -ef |grep -v grep |grep -cw <daemon process name>

if [ $PROCESSCOUNT -eq 0 ]
then
mailx -s "daemon process not running" myaddress@mydomain <msg body

fi


---------------------------------------------
place the above script in crontab and schedule it
to run every 5 mins depends on how soon you want to be notify

please let me know the out come of the above solution.
# 4  
Old 05-02-2002
Here is a fairly simple shell script that we use. It incorporates Killerserv's use of ps command.


You can run this as a cron job every 5 or so...

cat chk_daemon
_______________________
# check daemon
ps -ef | grep -v grep | grep daemon
# if not found - equals to 1, start it
if [ $? -eq 1 ]
then
/sbin/init.d/daemon start
else
echo "eq 0 - daemon found - do nothing"
fi
________________________
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check Running Processes

I want to check how many processes are running with same names and get their respective counts. ps -ef|grep -Eo 'process1|process2|process3| '|sort -u | awk '{print $2": "$1}' Output would look like : $ ps -ef|grep -Eo 'process1|process2|process3| '|sort | uniq -c | awk '{print $2":... (8 Replies)
Discussion started by: simpltyansh
8 Replies

2. UNIX for Beginners Questions & Answers

How to check if the script is already running?

I have one shell script in NAS shared location. Since NAS is mounted in many servers, script can be run from any of those servers. I want to make sure if the script is already running, it should not allow others to run it. I googled it and got some idea that i can touch one empty file in the... (8 Replies)
Discussion started by: thomasraj87
8 Replies

3. Shell Programming and Scripting

Check to see if script is already running

Happy New Year Is there a quick way to check to see if a script is already running. I want to put in a check in the script to exit, if already running. Currerntly i can only think of doing it the following way. # ps -ef | grep -i 3_HOUSEKEEPING_FFTVTL_TO_FFTDSSU_DUPLICATION.ksh |... (5 Replies)
Discussion started by: Junes
5 Replies

4. Solaris

How to check if a shell is already running ?

Hi, I put this at start of my shell (korn shell) to be sure that the shell is not already running and sometimes it fails and says that it is already running which is not true ! sleep 1 /usr/bin/ps -ef | /usr/bin/grep "$0" | /usr/bin/egrep -v grep>$LOGDIR/$0.res isup=$(cat $LOGDIR/$0.res|wc... (4 Replies)
Discussion started by: zionassedo
4 Replies

5. Shell Programming and Scripting

Check what cron is running

How to check what cron is scheduled to run? I don't want to modify anything. Thanks (1 Reply)
Discussion started by: stevensw
1 Replies

6. UNIX and Linux Applications

How to check if process is running?

Hi I would like to check if an instance of a script is already running. I've seen many different examples, but I haven't the slightest idea as to how to do this. Can you please help. Thank you. (5 Replies)
Discussion started by: ladyAnne
5 Replies

7. Shell Programming and Scripting

Check if Process is running

Hi , I have a csh code below which check the process if it's running. Can any expert advise me on the following: 1) what does this notationmean ">!" and how is it different from the append ">" notation ? 2) how does "setenv" work in this code ? # Check whether there is a running... (3 Replies)
Discussion started by: Raynon
3 Replies

8. Programming

How system deamons consuming less memory

Dear all, When I write the daemon programs it is consuming high memory and processor time. How can I avoid this? But, the system daemons are not consuming more. How? Can any one explain how the system daemons are handling the memory consumption and processor time. Thanks,... (1 Reply)
Discussion started by: nagalenoj
1 Replies

9. Shell Programming and Scripting

check process running

I have this script: ------------------------------------------------------- #!/bin/ksh # if ] || ] then echo "Executing main_load.sh script" /usr1/psc_load/jobs/cron/main_load.sh "ods" else echo "File not found, do nothing" fi exit 0 ... (4 Replies)
Discussion started by: rose1207
4 Replies

10. Shell Programming and Scripting

check that script is not running twice

using ps -ef | fgrep "ld_data" how do i write a script to check that it didn't already run Thanks (2 Replies)
Discussion started by: Link_02
2 Replies
Login or Register to Ask a Question