- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- selecting a node to run checks from a row
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
11-13-2006 07:03 PM
11-13-2006 07:03 PM
KSH scripting question:
I whant to run a checkscript on a mc/sg node to check the status of the packages of the cluster. I have a list of nodes in my script in an environment variable like 'NODES="hp1 hp2 hp3' and i like to check these nodes for availability to execute my checkscript with remsh.
What would be the code to do this selection process, first availible in line is fine with me.
Thanks in advance,
Klaas Eenkhoorn
Solved! Go to Solution.
- Tags:
- remsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2006 07:15 PM
11-13-2006 07:15 PM
Re: selecting a node to run checks from a row
You can do:
for node in $NODES; do
checkscript ...
done
Or do you want something to check if the node is ok enough to do remsh?
- Tags:
- for loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2006 07:18 PM
11-13-2006 07:18 PM
Re: selecting a node to run checks from a row
It is not my intension to run the script on all the nodes. The first one availible is fine.
Kl@@s
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2006 07:26 PM
11-13-2006 07:26 PM
Solutionfor node in $NODES; do
checkscript ...
if [ $? -eq 0 ]; then
remsh $node ...
break
fi
done
Basically you will have add some code to detect if the machine is up. (One possible check is to do remsh $node -n uname -a.)
If it is, you can do the real remsh and the break.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2006 07:38 PM
11-13-2006 07:38 PM
Re: selecting a node to run checks from a row
you can do:
#!/usr/bin/ksh
NODES="hp1 hp2 hp3"
for node in $NODES; do
remsh $node -l userid -n "ls" 2> /dev/null
ret=$?
if [ $ret -eq 0 ]
then
echo "$node ok"
exit
else
echo "$node failed"
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2006 10:47 PM
11-13-2006 10:47 PM
Re: selecting a node to run checks from a row
Dennis, thanks for the smart thinking.
Indeed after the first succesfull response from a host in the list, the status of the packages of that cluster are retreived and the main checkscript continues with other checks as i want it to be.
Now this results in the fact that the first available clusternode gives me the status of the packages even if one node is down.
That was what i wanted.
Klaas