LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices

Reply
 
Search this Thread
Old 10-28-2004, 12:47 PM   #1
samroberts
LQ Newbie
 
Registered: Oct 2004
Posts: 2

Rep: Reputation: 0
Emergency Shutdown scripts?


Hi,

I have been tasked with providing a method of shutting down our Linux + Unix farms in a simple way. This would be used in the event of an air conditioning failure, UPS failure or some other disaster which required us to shut everything down quickly.

We are running a mixture of Linux distros, Red Hat 7-9, Mandrake 10, Solaris 7-9. I would like to know if anyone else has got a method for performing such shutdowns - I don't want to start reinventing the wheel.

I have full root access to all the machine, so access is not a problem. I'd don't want a monitoring daemon running which is waiting to shut the box down (for obvious reasons).

My initial thoughts on the problem was to use a script issued from one machine which would open ssh sessions on the other machines and issue the shutdown command. Does anyone have anything like this that they could share with me? Or do you have another insight into this?

Many thanks in advance for any help

Sam Roberts
 
Old 10-28-2004, 01:16 PM   #2
Xolo
Member
 
Registered: Jul 2004
Location: The Netherlands
Distribution: Mandrake, Knoppix, Coyote Linux, RedHat
Posts: 354
Blog Entries: 3

Rep: Reputation: 31
Hmm, i'm not very familiar with shell scripting since i'm still learning, but perhaps this can still help you:

Expect:
http://expect.nist.gov/

it's an automation program for tasks such as yours. I know you don't want a daemon but perhaps it's still of some use? (Like, see what the program produces, copy it and create something useful out of it)
 
Old 10-29-2004, 04:12 AM   #3
samroberts
LQ Newbie
 
Registered: Oct 2004
Posts: 2

Original Poster
Rep: Reputation: 0
Many thanks for this, I found a few scripts on t'Internet which people had already written which open an ssh session to a machine.

For interest, and in case anyone else asks the question, I've included an example script in this post. From this, it is pretty trivial to set the script up to connect to many servers and issue the shutdown command. I'm going to put servers in different groups so I can apply some order to the shutdown process.

To get this to work, I had to install Expect and TCL onto a Red Hat 7.3 machine. Haven't tried it on the Solaris machines yet but I can't see this being a problem.

Thanks again for your help.

Sam

#=================================================#
#!/usr/local/bin/expect

package require Expect

spawn ssh servername -l root
expect "password: "
send "my_password\r"
expect "*#"
send "who;uname -a\r"
expect "*#"
send "exit\r"
#==EOF============================================#
 
Old 10-29-2004, 04:48 AM   #4
Xolo
Member
 
Registered: Jul 2004
Location: The Netherlands
Distribution: Mandrake, Knoppix, Coyote Linux, RedHat
Posts: 354
Blog Entries: 3

Rep: Reputation: 31
One is glad to be of service
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shutdown scripts? mushmaster Linux - Software 5 02-15-2005 06:23 PM
Emergency Shutdown iomari Linux - Networking 3 12-03-2004 01:25 AM
Where do you place shutdown scripts? zer0halo Linux - Newbie 3 08-24-2004 03:43 PM
Want to run a few scripts before KDE shutdown, where can I add them. Brian1 Linux - Software 6 06-16-2004 06:36 PM
How do i make scripts run at bootup and shutdown? BajaNick Linux - General 2 08-11-2003 08:37 PM


All times are GMT -5. The time now is 08:34 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration