| Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
10-28-2004, 12:47 PM
|
#1
|
|
LQ Newbie
Registered: Oct 2004
Posts: 2
Rep:
|
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
|
|
|
|
10-28-2004, 01:16 PM
|
#2
|
|
Member
Registered: Jul 2004
Location: The Netherlands
Distribution: Mandrake, Knoppix, Coyote Linux, RedHat
Posts: 354
Rep:
|
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)
|
|
|
|
10-29-2004, 04:12 AM
|
#3
|
|
LQ Newbie
Registered: Oct 2004
Posts: 2
Original Poster
Rep:
|
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============================================#
|
|
|
|
10-29-2004, 04:48 AM
|
#4
|
|
Member
Registered: Jul 2004
Location: The Netherlands
Distribution: Mandrake, Knoppix, Coyote Linux, RedHat
Posts: 354
Rep:
|
One is glad to be of service 
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:42 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|