Click to See Complete Forum and Search --> : shutting down a bunch of computers at once


kam
08-30-2002, 03:06 AM
Is there a way I can shut down a bunch of networked computers at once? Maybe using ssh? I'm going to be setting up a computer lab and I need a safe way to shut them all down painlessly.

I should add that they will be diskless clients.

mychl
08-30-2002, 10:55 AM
plug them all into the same power strip, then when you want to turn all the pc's off, just unplug the power strip.

Now I know this is very useless, but to me, on this dreary friday morn.... it is making me laugh histerically. So please forgive my smartA$$ness with this reply, for I could not help myself in the least.

I sincerely hope you find a solution to your query, thanks for the laugh.....

kam
08-30-2002, 01:27 PM
:) Ya I already thought of that one. :)

But they need to unmount properly and all that stuff it does during shutdown.

Infrastructure
08-30-2002, 05:03 PM
If you have a NFS server on each of the clients you could place a shutdown BASH script on each of them and then execute them from one computer, just write a BASH script that executes the shutdown scripts. DISCLAIMER: This is just a wild idea. Check with the people over at:

Linux Terminal Server Project (http://www.ltsp.org/index.php)

The might have some better ideas.

kam
08-30-2002, 07:18 PM
Well, the invidual computers wouldn't need a script; its only a one-liner. But maybe I can make a script on the server that will connect and issue a shutdown to each of the computers.

jumpedintothefire
08-31-2002, 12:02 AM
I don't recall if there are active files locks with nfs that could mess thing up with a quick power off. What if the network went down by unplug the hub?? Would that damage anything? Sorry, not to well versed in nfs, yet....

I'd look at using expect and telnet or some other login method. With expect you can script the resposnses to the login sequence, commands like su, and known questions, then finally shutdown.


sample from my /usr/bin/ftp.expect on RH 7.3:
this one logins into ftp and grabs a file

#!expect -f

set site [lindex $argv 0]
set dir [lindex $argv 1]
set theirname [lindex $argv 2]
set myname [lindex $argv 3]
set password "$env(USER)@"

set timeout 60
spawn ftp $site
expect "*Name*:*"
send "anonymous\r"
expect "*Password:*"
send "$password\r"
expect "*ftp>*"
send "binary\r"
expect "*ftp>*"
send "cd $dir\r"
expect "*550*ftp>*" {exit 1} "*250*ftp>*"
send "get $theirname $myname\r"
expect "*550*ftp>*" {exit 1} "*200*226*ftp>*"
close
wait
send_user "FTP transfer ok\n"
exit 0

It will take some trial and error, but it should be do-able Hope this helps..

karthik
08-31-2002, 12:56 AM
u can use the rcp command and remotely execute the shutdown command on all the computers in the network. U need to make one computer like a server kind of system from where you will be operating on all the other computers in the network. u need to setup the .rhosts file also to allow this central computer to remotely execute commands. U can compile a script which will execute this command on all the computers.

If security is an important issue then you should consider other options or else this is a feasible idea.

kam
08-31-2002, 01:11 AM
Originally posted by jumpedintothefire
I don't recall if there are active files locks with nfs that could mess thing up with a quick power off. What if the network went down by unplug the hub?? Would that damage anything? Sorry, not to well versed in nfs, yet....


I remember reading that! Ya, diskless clients don't need a proper shutdown because they are actually just running off the server.