- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script to check the process
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
10-14-2009 02:52 AM
10-14-2009 02:52 AM
Script to check the process
$/tmp/my_script
report1 ok
report2 ok
report3 ok
my reqiurement is :
if run myscript , the result generated three lines ( as above ) , then it is normal , if the result is not three lines , then it is not normal , I want to send a notify mail to me in case it is not normal , the logic is as below .
====================
/tmp/my_script
if result is three lines ; then do nothing
else
send notify mail to me
fi
=====================
can advise how can I write this script ? thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2009 02:56 AM
10-14-2009 02:56 AM
Re: Script to check the process
tell me one thing if your script fail then how many lines are display.
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2009 03:17 AM
10-14-2009 03:17 AM
Re: Script to check the process
not regular , may be one , two or over three lines or even a empty result , so what I want is if the result is not three lines , then define it is a fail case , then send notify mail .
thx for help .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2009 03:29 AM
10-14-2009 03:29 AM
Re: Script to check the process
sh /tmp/my_script |grep -v "report1 ok" |grep -v "report2 ok"|grep -v "report3 ok" > /dev/null
if $?=0
then
echo mail
else
echo "no mail"
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2009 03:35 AM
10-14-2009 03:35 AM
Re: Script to check the process
#!/usr/bin/sh
if (( `cat myscript|wc -l` != 3 ))
then
mailx ..
else
echo good
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2009 12:58 AM
10-15-2009 12:58 AM
Re: Script to check the process
you could use this way:
create a new script:
#/usr/bin/sh
cd /tmp
my_script 2>my_script.err 1> my_script.log
cat my_script.log
if [[ $(wc -l my_script.log != 3 ]] || [[ $(wc -l my_script.err > 0 ]]; then
(echo; uuencode my_script.err my_script_err.txt; echo;uuencode my_script.log my_script_log.txt) \
mailx -m -s "my_script KO" your@address
fi
#eof
HTH,
Art