The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shutdown script kingsto88 HP-UX 0 03-20-2007 08:43 PM
A script for shutdown kelu UNIX for Dummies Questions & Answers 12 08-23-2006 09:09 PM
I need a Script to rsh multiple hp boxes and shutdown blackfam972 Shell Programming and Scripting 2 05-09-2006 11:59 AM
Shutdown script alpha_manic UNIX for Advanced & Expert Users 10 09-14-2005 04:14 PM
logout/shutdown script ropers UNIX for Dummies Questions & Answers 1 08-02-2002 02:05 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-30-2009
ulemsee ulemsee is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 6
Multiple ssh, shutdown and exit script

PROBLEM:

I need to ssh into multiple remote machines, send a shutdown command and exit. The remote servers will then run their own scripts to gracefully shutdown their applications before shutting down.

ONE: This is to be achieved without using public key authentication; this is being avoided as a security measure. (Not negotiable) :-)

TWO: Passwords are required.

SO FAR:
I wrote an expect script that ssh's into the remote server, and calls on a script. Trouble is the expect script on the "master" server waits for the remote script to complete before exiting,thus time is wasted (I am trying to shut down several servers within a certain time).

Is there a way to run multiple instances of my expect script simultaneously, or /and is there another way to do this. If sequentially, then in the shortest time possible.


Thanks!!!
  #2 (permalink)  
Old 07-02-2009
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,546
Well the only UNIX box I can think of which was able of parallele cmds was IBM SP (big blue...and followers).
I tried rdist and fell on your situation, and that was due to the loop...
Havent tried with rsync though... and havent tried multiple instance of expect, but did try at the time a workaround to speed up things:
schedule cron for the presence of a dummy file ( I did this for Y2K testings for shutdown of 30 servers.. )to execute your shutdown script.

---------- Post updated at 09:53 ---------- Previous update was at 09:48 ----------

Thinking of it now, you could try to schedule with at in your expect, that would be faster since after the at cmd (something like at now + 2 minutes...) it would have finished (if it works..) keep us informed (could be interesting!)
  #3 (permalink)  
Old 07-02-2009
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,864
Quote:
ONE: This is to be achieved without using public key authentication; this is being avoided as a security measure. (Not negotiable) :-)
Then may I suggest that your supervisors invest in this technology

Seriously, create a listening daemon each server that responds only to a specific IP address, and if really necessary, a password string. Once the string has been received, issue the shutdown command. It's a 5 line perl program. No need to parallelize since the string is sent and your client script just goes to the next server.
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate 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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 05:01 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0