- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: A korn shell Script for test up/down nodes
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
Forums
Discussions
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
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-16-2007 09:08 AM
03-16-2007 09:08 AM
#!/usr/bin/ksh
##################################################
#
# Check status of OVO agent - Ping Test Only
#
##################################################
INFILE=$1
if [[ -z $1 || ! -f $1 ]]; then
echo "Pls specify a valid input filename"
exit 9
fi
OUTFILE=/home/aa6491/agent_ping_test.out
OUTFILE2=/home/aa6491/agent_ping_test.rpt
/momauto/managers/OV/log #this is the right path where the files should be written to.
> $OUTFILE
> $OUTFILE2
Total_Nodes=`wc -l $INFILE | awk '{print $1}'`
Node_Num=0
echo `date +"%x %X"` "Node PING test started for $Total_Nodes configured nodes"
for nodename in `cat $INFILE`; do
(( Node_Num = $Node_Num + 1 ))
ping $nodename -n 1 >/dev/null 2>/dev/null
RC=$?
if [[ $RC -ne 0 ]]; then
echo `date +"%x %X"` "$nodename:Agent $Node_Num of $Total_Nodes, did not respond to ICMP ping" | tee -a $OUTFILE2
else
echo `date +"%x %X"` "$nodename:Agent $Node_Num of $Total_Nodes, did respond to ICMP ping" | tee -a $OUTFILE2
fi
done
echo `date +"%x %X"` "Node PING test complete"
exit 0
Do you guys have any other suggestions on how i should be modifying and implementing new features to this script? Do you have any other new script suggestion for this case? It's URGENT. I would appreciate any help. Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2007 01:06 PM
03-16-2007 01:06 PM
Re: A korn shell Script for test up/down nodes
to change the script you have? What new
features do you want? For what kinds of
suggestions are you looking?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2007 03:48 PM
03-16-2007 03:48 PM
SolutionTotal_Nodes=$(wc -l < $INFILE)
And replace archaic `` by $() throughout.
You don't need the "$" in (( )):
(( Node_Num = $Node_Num + 1 ))
No need for cat:
for nodename in $(< $INFILE); do
You set $INFILE at the top. You then check $1, you should be consistent and use $INFILE. And in your error message, you should echo $INFILE so the error is reinforced by the bad name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2007 02:12 AM
03-17-2007 02:12 AM
Re: A korn shell Script for test up/down nodes
complaint might be that it does not allow the
input file to include any comments, which is
bad for at least two reasons. (Or blank
lines?)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2007 02:03 AM
03-19-2007 02:03 AM
Re: A korn shell Script for test up/down nodes
Hi Dennis
Thank you very much for your help. I could ask you only one more thing. How ecxatly would you build this script having mine as an example? I mean, could you write it down throughout with your considerable optimizations? If there will be some explanation on the optimization i would be glad, it's been quite a whil i haven't ben into korn shell script. I'll implement this in the next few weeks in a very large enviroment for a HP client. Thank you one more time Dennis and i wait for your feedback.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2007 08:39 AM
03-19-2007 08:39 AM
Re: A korn shell Script for test up/down nodes
client, you don't know how to do the job, and
you can't even implement the suggestions you
already have, so you want someone else to do
your whole job for you for free (or for a few
ITRC points)? Or do I misunderstand?
Perhaps you should hire a (sub-) contractor
who _does_ know how to do your job. (But,
hey, if you can get someone to do your job
for nothing, it's ok with me.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2007 10:11 AM
03-19-2007 10:11 AM
Re: A korn shell Script for test up/down nodes
Well, yours seems to do what it says. (I don't see any use of $OUTFILE.)
You do know that just because you can ping a system doesn't mean it isn't hung?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2007 08:25 AM
03-20-2007 08:25 AM
Re: A korn shell Script for test up/down nodes
I won't use the $OUTFILE just the $OUTFILE2.
I tried to made those changes you sent to me but didn't worked it out. The script got an error.When i put the script back, it worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2007 03:02 PM
03-20-2007 03:02 PM
Re: A korn shell Script for test up/down nodes
Can you attach your script so I can look at the error? And provide error message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2007 01:43 AM
03-21-2007 01:43 AM
Re: A korn shell Script for test up/down nodes
Hi Dennis,
I'm sending you the file attached. See what you can get from it. If you make any modifications and or get it optimized, let me know.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2007 10:12 PM
03-21-2007 10:12 PM
Re: A korn shell Script for test up/down nodes
I changed:
Total_Nodes=$(wc -l < $INFILE)
for nodename in $(< $INFILE); do
(Note this will allow multiple hosts on one line but your wc won't count them. You could change to wc -w.)
Each line with `date` to:
echo $(date +"%x %X") ...
There were two lines with: | >> $OUTFILE2
I assumed you didn't remove the tee completely?
echo $(date +"%x %X") "$nodename:Agent $Node_Num of $Total_Nodes, did not respond to ICMP ping" >> $OUTFILE2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2007 01:02 AM
03-22-2007 01:02 AM
Re: A korn shell Script for test up/down nodes
Yes, i didn't remove the "tee" for the "$OUTFILE" just to see the testing results on the screen in real time.I'll be doing this when i implemtent the script in the production enviroment. The 2 lines containing >>OUFILE2 are for diffrent purposes if haven't pay enough atention:
if [[ $RC -ne 0 ]]; then
echo `date +"%x %X"` "$nodename:Agent $Node_Num of $Total_Nodes, did not respond to ICMP ping" | >> $OUTFILE2
else
echo `date +"%x %X"` "$nodename:Agent $Node_Num of $Total_Nodes, did respond to ICMP ping" | >> $OUTFILE2
fi
done
----- one is for the nodes which responds and other wich doesn't. -------
- Look , i tried to make those changes you made and as i stated before in the last post, for some readon it didn't work out.
could you send the attached file with the changes you made on it for me be able to test it out?!
ThX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2007 01:09 AM
03-22-2007 01:09 AM
Re: A korn shell Script for test up/down nodes
Yes, i didn't remove the "tee" from the script yet for the the single reason i want to see the output on the screen in real time as the script runs,ok? This will be done later.
As for the changes you've made on the script for some reason it didn't work it out, as i stated in the last post, when i made those changes (Total_Nodes/ for nodename , etc)i got an error when the scritp ran.
Regarding the 2 ">>OUTFILES2" , they are for different purposes.One for the nodes wich reponde to the ping and the other for the ones wich do not,ok.
Could you attach a file with your changes so that i can test it out completly?
Thx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2007 01:35 PM
03-22-2007 01:35 PM
Re: A korn shell Script for test up/down nodes
They were only partially removed so it had bad syntax.
>Could you attach a file with your changes so that i can test it out completly?
Attached