HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Email notification when a service stops
Operating System - HP-UX
1834150
Members
2129
Online
110064
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
05-23-2006 02:17 AM
05-23-2006 02:17 AM
Email notification when a service stops
We have a service running that returns the following message when active :
ps -ef|grep strs
root 7111 1 0 14:15:05 ? 0:43 /u01/data/app/PROD/appl/stream/strs/strs -a start.arg
What i would like to happen would be for the box to email out when the start.arg doesnt exist, but i have no idea on how to do this
If you guys could help me out in anyway, it would be greatly apreciated
Cheers
Dave
ps -ef|grep strs
root 7111 1 0 14:15:05 ? 0:43 /u01/data/app/PROD/appl/stream/strs/strs -a start.arg
What i would like to happen would be for the box to email out when the start.arg doesnt exist, but i have no idea on how to do this
If you guys could help me out in anyway, it would be greatly apreciated
Cheers
Dave
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2006 02:22 AM
05-23-2006 02:22 AM
Re: Email notification when a service stops
Here's a general purpose one. You can create a 'cron' task for it. Assume that you want to look for a process called "myproc" and mail/page if it isn't running:
# [ -z "`UNIX95= ps -C myproc -o pid= -o comm=`" ] && mailx -s "myproc" is not running!" root < /dev/null
Change the 'myproc' to match the basename of the process that you're interested in monitoring. As shown, this generates a mail to 'root'.
In your case, the basename of your process is 'strs'. Substitute that string for 'myproc' in the above script.
Regards!
...JRF...
# [ -z "`UNIX95= ps -C myproc -o pid= -o comm=`" ] && mailx -s "myproc" is not running!" root < /dev/null
Change the 'myproc' to match the basename of the process that you're interested in monitoring. As shown, this generates a mail to 'root'.
In your case, the basename of your process is 'strs'. Substitute that string for 'myproc' in the above script.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2006 02:26 AM
05-23-2006 02:26 AM
Re: Email notification when a service stops
Hi Dave,
You can write a script and keep in cron to monitor every minute
it will do
ps -ef |grep strs
NOP=$(ps -ef |grep strs|grep -v grep |wc -l)
if [ $NOP -lt 1 ]
then
MESS=$(echo "STRS proc not running")
mailx -s $MESS username
else echo working
fi
Chan
You can write a script and keep in cron to monitor every minute
it will do
ps -ef |grep strs
NOP=$(ps -ef |grep strs|grep -v grep |wc -l)
if [ $NOP -lt 1 ]
then
MESS=$(echo "STRS proc not running")
mailx -s $MESS username
else echo working
fi
Chan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2006 02:31 AM
05-23-2006 02:31 AM
Re: Email notification when a service stops
You could just make the same script send the email... (but fwiw, I like James' posting better than this idea). This is only good b/c of its simplicity.
You can make the program wait for the strs to end, and then send the email. Like so:
#!/bin/ksh
/u01/data/app/PROD/appl/stream/strs/strs -a start.arg > logfile 2>&1 &
wait
echo "strs has stopped" | sendmail youruser@yourserver.com
You can make the program wait for the strs to end, and then send the email. Like so:
#!/bin/ksh
/u01/data/app/PROD/appl/stream/strs/strs -a start.arg > logfile 2>&1 &
wait
echo "strs has stopped" | sendmail youruser@yourserver.com
We are the people our parents warned us about --Jimmy Buffett
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP