- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to do it? ps -ef and send mail
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
12-28-2003 07:16 PM
12-28-2003 07:16 PM
I need to perform a check and send mail with results:
steps are:
1.do a command:
# ps -ef | grep MGR | grep erpmgr
=> if it returned a process id , that means running normally,
ex.
# ps -ef | grep MGR | grep erpmgr
erpmgr 19249 19232 0 15:08:43 pts/tc 0:01 FNDLIBR FND CPMGR FNDCPMBR sysmgr="" logfile=/u04/prodc
#
=> if it returned nothing , send a alert mail to SYSADMIN
2.I have a send mail scripts in HP-UX 11.0,
for example:
# sh /usr/local/bin/mimemail.sh < /mail_body
BUT I need some scripts to perform "ps -ef" , and call mimemail.sh to send alert mail if no process been found.
Thanks for any reply.
Violin.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2003 07:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2003 07:37 PM
12-28-2003 07:37 PM
Re: How to do it? ps -ef and send mail
unfortunaly i have a small amount of time, to think to the check, but:
#!/sbin/sh
PID=$(ps -ef | grep MGR | grep erpmgr)
[ -n $PID ] && echo "No running MGR found" | mailx -s "ALERT: MGR NOT RUNNING" name.surname@yourdomain.com
#################END##################
Masssimo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2003 07:39 PM
12-28-2003 07:39 PM
Re: How to do it? ps -ef and send mail
[ $PID ] && (echo "No running MGR found" | mailx -s "ALERT: MGR NOT RUNNING" name.surname@yourdomain.com )
####
TR: if PID is null, then no MGR is running, so send the mail
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2003 12:38 AM
12-29-2003 12:38 AM
Re: How to do it? ps -ef and send mail
your script is clear and simple for me.
x=`ps -ef|grep
if [ x -eq 0 ]
then
sendmail
else
echo
processes are runing fine
fi
but one more question:
I want to add a condition in if,
x=`ps -ef|grep
y=`ps -ef|grep
if x=0 and y>0 => how to do it in shell script?
Thx.
Violin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2003 12:53 AM
12-29-2003 12:53 AM
Re: How to do it? ps -ef and send mail
x=`ps -ef|grep oracle|grep pmon|wc -l`
y=`ps -ef|grep oracle|grep smon|wc -l`
if [ $x -eq 0 -a $y -eq 0 ]
then
sendmail
else
echo processes are runing fine
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2003 01:28 PM
12-29-2003 01:28 PM
Re: How to do it? ps -ef and send mail
I've solved my problem,
Thx again & Happy New Year!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2003 02:19 PM
12-29-2003 02:19 PM
Re: How to do it? ps -ef and send mail
#!/usr/bin/sh
# Search for pmon and smon
if UNIX95= ps -C pmon > /dev/null
then
if UNIX95= ps -C smon > /dev/null
then
echo "all is well"
else
ps -u oracle | mailx "smon not running"
user@domain.com
fi
else
ps -u oracle | mailx "pmon not running"
fi
By using the -C option (requires the temp variable UNIX95=) ps will not find users with the name pmon3 or processes like upsmon.
Bill Hassell, sysadmin