- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: how to check a deamon live or dead?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2004 10:49 PM
03-21-2004 10:49 PM
Let's say i have deamon and name xyz...i want to take an alert,e-mail message when this deamon stopped or killed..so how can i organize this scenario?
Please share your precious decisions...
Best Regards,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2004 10:55 PM
03-21-2004 10:55 PM
Re: how to check a deamon live or dead?
Umapathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2004 11:02 PM
03-21-2004 11:02 PM
Re: how to check a deamon live or dead?
If your daemon can not be made to run in the foreground, you'll just have to do the regular "ps | grep" thing which always seems a bit nasty to me but sometimes there's no choice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2004 11:17 PM
03-21-2004 11:17 PM
Re: how to check a deamon live or dead?
I would just do a simple script and grep for the deamon (ps -ef | grep xxxx) and mail or page myself if the daemon is not shown in the grep command above. You can use sleep to run it at regular intervals or just put it in the crontab.
Alternatively you can also look at the other means which our friends have illustrated in prior posts and see what best fits your needs
rgds
Mobeen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2004 11:47 PM
03-21-2004 11:47 PM
Re: how to check a deamon live or dead?
Thak's so much for your kind concern...
i can get the process name via
ps -ef|egrep -i processname and i want to write a script and put it on cron...but how??
just want you to be a little clear...please
try to give some examples...
Best Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2004 11:56 PM
03-21-2004 11:56 PM
Re: how to check a deamon live or dead?
mailx -s "process has died" myemail@mydomain
}
That's your script and if you called /usr/local/bin/checkdaemon you could put it in cron to run every ten minutes like this
00,10,20,30,40,50 * * * * /usr/local/bin/checkdaemon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2004 12:09 AM
03-22-2004 12:09 AM
Re: how to check a deamon live or dead?
#!/usr/bin/sh
# monitor a specific program
# report if not running or more than 1 is running
# Usage: watchprog program_name
set -u
PATH=/usr/bin
MYNAME=${0##*/}
if [ $# -lt 1 ]
then
echo "\nUsage: $MYNAME program_name\n"
exit 1
fi
MYPROG="$1"
PROCLIST=$(UNIX95= ps -C $MYPROG -o pid | grep -v "PID")
if [ "$PROCLIST" = "" ]
then
echo "$MYPROG stopped $(date)" | mailx -s"$MYPROG stopped" root
exit 2
fi
PROCNUM=$(echo "$PROCLIST" | wc -l)
if [ $PROCNUM -gt 1 ]
then
echo "$MYPROG multiple copies running, PIDs= $PROCLIST $(date)" \
| mailx -s"$MYPROG more than 1 copy" root
exit 3
fi
exit
Put this in cron, perhaps running every 10 minutes:
0,10,20,30,40,50 * * * * /usr/contrib/bin/monprog mydaemon
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2004 02:35 AM
03-22-2004 02:35 AM
Re: how to check a deamon live or dead?
i am really new at scripting so could you please check me..
#!/usr/bin/sh
proc_name=`ps -ef|grep -v grep|egrep -i rvs01|egrep -i ttaad|awk '{print $14}'`
proc_name=${proc_name:-"ttaad5206m000"}
if [ "$proc_name" = "ttaad5206m000" ]
then
exit1
#because i am serachin the proc_name ttaad5206m000
else
echo "$proc_name stopped $(date)" | mailx -s"$proc_name stopped" root
fi
so could it be the solution? or other suggestions...
Best Regards,
mailx -s "$proc_name stopped"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2004 02:59 AM
03-22-2004 02:59 AM
Re: how to check a deamon live or dead?
monproc ttaad5206m000
The ps -ef | grep strings are not very reliable.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2004 06:05 PM
03-22-2004 06:05 PM
Re: how to check a deamon live or dead?
First of all i would like to thank you about
your very helpful script...yes it works but
needs a little bit modifications and this is my fault given misssing information.
When i run the command;
ps -ef|egrep -i rvs|egrep -i bshell
always returns like;
rvs 23091 23090 0 09:23:51 ? 24:41 bshell (rvs01[rvs]:23090/PIPE) 23090 321 6 7 ttaad5206m000
rvs 23046 23045 0 09:23:03 ? 0:01 bshell (rvs02[rvs]:23045/PIPE) 23045 321 6 7 ttaad5206m000
This means i have to see deamon ttaad5206m000
two times but depends rvs01 and rvs02
so if i miss one of them this means i have problem and mail root or etc...
So now,How can i modify your sript?
Thank' so much again for your kind concern...
Best Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2004 12:10 AM
03-23-2004 12:10 AM
Solutionps -f -u rvs
egrep is an expensive form of grep as it runs through extended regular expression code such as choice1|choice2|choice7 as a search criteria. For simple string matches, fgrep (or grep -F) is much faster and will allow searching for special characters like * and ? if needed.
So is the relationship that each bshell (rvs## must have a matching ttaad5206m000? It appears that each ttaad5206m000 daemon starts a bshell process based on PID and PPID. Now if ttaad5206m000 disappears, the child bshell should also disappear unless the child disconnects from the parent. So we'll need a little more detail on how the daemon and child processes are supposed to work. Perhaps the code could be fixed to prevent loss of the daemons rather than searching for them every few minutes?
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2005 06:53 PM
05-22-2005 06:53 PM