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 > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
S-174: Vulnerability in OLE Automation iBot Security Advisories (RSS) 0 02-12-2008 07:30 PM
Web automation using perl gurukottur Shell Programming and Scripting 1 10-11-2007 12:22 AM
FTP automation Job scheduling SATYAPRIYA_D UNIX for Advanced & Expert Users 1 04-27-2007 10:13 AM
X11 automation? dlundh OS X (Apple) 1 04-18-2007 08:20 AM
Automation of telnet and ftp asutoshch UNIX for Dummies Questions & Answers 10 11-09-2001 12:51 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-03-2008
nua7 nua7 is offline
Registered User
  
 

Join Date: Mar 2008
Location: /bin/sh
Posts: 353
Help in automation...

Hi All,
I need to run the same command on many servers. I am using ssh for the same. Following is the script that I am using to fire the same command on multiple machines.

Code:
#!/bin/bash
# Linux/UNIX box with ssh key based login
#SERVERS="iqmevrick,iqmango"
# SSH User name
USR="root"
# connect each host and pull up user listing
for host in `cat list`
do
ssh $USR@$host date 
done
But the problem is I need to have this script running without asking password.So it has to be non-interactive. I tried using expect script for the same. Following is the expect script that I came up with, but it is not working.

Can someone please help...

Code:
#!/usr/bin/expect -f
# now connect to remote UNIX box (ipaddr) with given script to execute
spawn ssh root@$ipaddr date
match_max 100000
# Look for passwod prompt
expect "*?assword:*"
# Send password aka $password
send -- "$password\r"
# send blank line (\r) to make sure we get back to gui
send -- "\r"
expect eof
 

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 12:48 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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