We help IT Professionals succeed at work.

Bash Shell Sript to Echo and write to text file.

capperdog13
capperdog13 asked
on
611 Views
Last Modified: 2013-12-19
Hi, I am working with a ROCKS cluster on RHEL 5.9. It is running PBS as the grid. I want to make sure that all ot the nodes of the cluster are responive, so I need a script that will possibly grab the name, date and time stamp from each node and write that info back to a text file on the front end node.

Can someone provide a quick example? Google is of too much help on the subject!
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2007
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Great! Let me work with this and I will respond later today. The nodes do require a password, so the rsh script I don't think will apply.

Many thanks! Will get back with you.
CERTIFIED EXPERT

Commented:
Do you have the ganglia roll installed and enabled?  You can just use that to track all the compute nodes.

Rocks also includes the tentakel command to query all the hosts more quickly, since it forks all the calls at once.  It should be set up if you loaded all the compute nodes with the rocks installer.  If you want the results to come back in order, you can sort the results afterwards.  The while loop could take quite a while if you have a lot of compute nodes.

It's much simpler to run this line to query all the hosts simultaneously.  Your results will likely come back out of order, but it'll be much faster than running the while loop and waiting for each node's network to respond.

tentakel "hostname; date; hostaname" >> compute_nodes.txt

If I remember correctly, I think you actually just need

tentakel date >> compute_nodes.txt

since tentakel already outputs the hostname of the system with the command.

The head node should have an ssh key automatically installed on each of the compute node already.  You shouldn't need a password when you run tentakel or ssh to the compute nodes, unless the installer messed up somehow or the system becomes corrupted by the users code crashing.  That does happen frequently enough when you have hundreds of systems, but the compute nodes should be easy and quick to reinstall.

http://www.rocksclusters.org/roll-documentation/base/5.5/index.html  You can install other linux distros with Rocks.  Rocks 6 is out and that supports Redhat 6

Author

Commented:
Hi yes we do have Ganglia installed and from the Web Front End all looks fine. Thanks for the tentakel date >> compute_nodes.txt It says all is fine as well.

I was just handed this old POS, so is it safe to say that from a high level that this cluster is functioning as it should relying on the tentakel cmd and the Gaglia front end??

Author

Commented:
Also, I do notice one problem you may be able to help with. The nodes are not reloading when I tell them to on a hard reboot. PXE is enabled on the nodes and they do make contact with the front end, but the frontend never sends a packet for the reload, time out occurs and the node boots back up to old image.

Any suggestions here?
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Hey thanks a bunch for all the info! I come from a Windows background and was literally tossed into the sea of Linux and told to fix that cluster...

I did the commands on the head node and forced an install on one of the nodes. I checked it with ROCKS LIST HOST BOOT before I hard rebotted the node, but it still did not reload. The nodes are not getting the info back from the server to reload like I mentioned ealier.

Anyway I am going to post this to the ROCKS site you gave me. You've been a big help!
Many thanks and have a happy holiday!!

Author

Commented:
The original question was about a script to help me check a ROCKS cluster. Simon supplied me with a couple of great examples. thanks Simon! I did get the most help from serial, who has ROCKS experiance and went over and above with tips and links to help out.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.