I Need Help. I am a Linux Newbe. I have been tasked to build a build a Beiwolf Cluster. However, my immediate problem is. H :confused: ow can I shut down each Linux box using a telnet command from remote as an emergency procedure such as AC Failure or power failure in the server room.

Recommended Answers

All 7 Replies

I'm a tad confused. If the power is suddenly pulled, there is no time to initiate a clean shutdown. In that case you would need to purchase a UPS Power Backup.

I use two commands to shutdown. halt and shutdown "now" ... there is also the shutdown -r "now" command to restart. The value in quotes is in how much time you want the shutdown procedure to start. As far as I know, halt can only be used by a super user.

The entire server room is on UPS. In this area we experience Brownouts. The UPS are good for an hour. The main problem is AC cooling is lost. Security will alert person on "call list". one or two persons will come on site a shut down all 60 servers systems therefore the manual shut down procedure must be quick. We got if covered for Windows boxes. But the Linux Cluster need a guick procedure because non of the cluster boxes have monitors, keyboards or mice attached. So telnet or ftp is the only way to communicate with each cluster host.


This was discussed in another topic involving UPS shutdown to other computers. Also, as a newbie, a Beowolf cluster is quite a haul!

What I would do is:
1) determine the order that the boxes have to be shut down in. I have not built a Beowolf cluster, and it might not matter, but boxes might have to go down in a certain order.
2) Collect the IP numbers and root usernames / passwords for each box.
3) Install / Verify that SSH and expect is installed on all of the computers
4) Use expect to create a script file for one central computer to order the rest of them to power down. Expect is an "interactive" shell language that is great for username / passwords and similar interaction.
5) Code it and test it.

Things to watch out for:

1) Telnet will not allow a root login. SSH will, but will also require a pre-login before the script runs to setup and accept the encryption keys.
2) Your script must be protected from prying eyes, and also on the computer, as it will have all the root passwords handy
3) If you have to wait for delays between server shutdowns, remember to encode them into your script.

As you are starting on this, Thomase, rough out your thoughts in pseudo code and post them here. DO NOT put in passwords or sensitive IP addresses... but we can help debug it.


here would be a good script:

(the pre-req is that you have ssh installed on everything and can log into every server by using public keys instead of passwords)

 POWERCMD="/sbin/shutdown -h now"
 HOSTS="server1 server2 server3"
 # Shutdown remote machines
 for i in $HOSTS;
 	 $SSH -l root $i $POWERCMD;
 # Shutdown ourself
 /sbin/shutdown -h now

I provide no warranties so use at your own risk. :)

Many thanks for your input. I see I have a lot to learn in the Linux world. scripting and all that. Windows xp is a peace of cake compared to this. Its like going back to my IBM Main Frame programming days in Assembly Language Coding (ALC). But I'll survive, I got a pile of text books in one hand and the keyboard in the other. I will try out the script you provided :)

Thank you for your structured thoughts. I will put these to use. This my first attempt to build a cluster on my own. The first time I was just assisting my manager and was feeding each node a kickstart diskette and changing some parameters on the screen. Since I have to learn Linux now I decided to also learn clusters and show our inhouse clients how to put up cluster applications. :) :)

Hello Thomase,

Windows XP / 2003 Server is not a piece of cake. True, you might not be aware of the tools that are in Linux, you will find that there are a lot less hidden registry settings and other nit-noids that go into a Windows system. Linux configuration files are often pure text files that are easily printable and managable. There is not much too them at all. Yes, syntax will be important, but if you had to, you could edit them with a 2400 baud modem.

Enjoy, and let us know how you did it. Keep very good notes of each installation (I used a bit text file on one of the computers as a running log, and it worked well -- just be sure to print it when done).


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.