Sponsored Content
Full Discussion: Check if deamons are running
Top Forums UNIX for Dummies Questions & Answers Check if deamons are running Post 20694 by hassan2 on Thursday 2nd of May 2002 09:11:49 AM
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.
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 07:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy