HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Need one script to send E-mail.
Operating System - HP-UX
1832310
Members
2141
Online
110041
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
10-19-2000 04:24 PM
10-19-2000 04:24 PM
Need one script to send E-mail.
I need a simple script to send an E-mail based on some condition. This script I will put in crontab.
I want to check if Oracle database is down, then send E-mail notification to DBA.
For exaple:
IF [ Database is Down] then
echo 'Message' |sendmail gulam@region.on
Endif
We usually check if Oracle is up or down by
$ps -ef|grep pmon
If there is any oracle pmon process running, this command will show its details, so this means Oracle is up otherwise it is down.
But I really don't know how to check this condition.
Thanks,
Gulam.
I want to check if Oracle database is down, then send E-mail notification to DBA.
For exaple:
IF [ Database is Down] then
echo 'Message' |sendmail gulam@region.on
Endif
We usually check if Oracle is up or down by
$ps -ef|grep pmon
If there is any oracle pmon process running, this command will show its details, so this means Oracle is up otherwise it is down.
But I really don't know how to check this condition.
Thanks,
Gulam.
Everyday Learning.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2000 04:44 PM
10-19-2000 04:44 PM
Re: Need one script to send E-mail.
Try something like this..
#!/bin/sh
# Author: Anthony Goonetilleke
# Desc: Monitor Oracle instances
######################################
ORA_INSTANCES=24
CUR_ORA_INSTANCES=`ps -ef | grep -c pmon`
HOST=`/usr/bin/hostname`
MAIL="/usr/bin/mailx"
SUBJECT="Problem on ${HOST}: ${CUR_ORA_INSTANCES} Ora instances available"
RECIPIENTS="youremail@domain.com"
if (( $CUR_ORA_INSTANCES < $ORA_INSTANCES ))
then
echo "You have an Oracle problem" | $MAIL -s"${SUBJECT}" $RECIPIENTS
else
echo "You dont have an Oracle problem" | $MAIL -s"All is well" $RECIPIENTS
fi
#!/bin/sh
# Author: Anthony Goonetilleke
# Desc: Monitor Oracle instances
######################################
ORA_INSTANCES=24
CUR_ORA_INSTANCES=`ps -ef | grep -c pmon`
HOST=`/usr/bin/hostname`
MAIL="/usr/bin/mailx"
SUBJECT="Problem on ${HOST}: ${CUR_ORA_INSTANCES} Ora instances available"
RECIPIENTS="youremail@domain.com"
if (( $CUR_ORA_INSTANCES < $ORA_INSTANCES ))
then
echo "You have an Oracle problem" | $MAIL -s"${SUBJECT}" $RECIPIENTS
else
echo "You dont have an Oracle problem" | $MAIL -s"All is well" $RECIPIENTS
fi
Minimum effort maximum output!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2000 11:28 PM
10-19-2000 11:28 PM
Re: Need one script to send E-mail.
Simply you can do like this:
#!/bin/sh
# check about oracle database
orac_chk=`ps -ef| grep pmon | grep -v grep`
if [ ${#orac_chk} -eq 0 ]
then
echo "oracle is DOWN" | mailx -s ?racle check"gulam@region.on
fi
regards,
federico
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