LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-20-2004, 02:00 PM   #1
jmr71769
Member
 
Registered: Jun 2003
Location: East Coast, USA
Distribution: Gentoo, Debian, Slack, FreeBSD
Posts: 82

Rep: Reputation: 15
using expect scripts for remote admin


hello everyone.

i've read the expect pages up and down (aka man expect). and while i've gained basic knowledge of the tool, i'm a bit stuck with an advanced topic.

my mission:

to remote admin multiple debian boxes and update them using a simple script.

there are 10 boxes, so this script would be something like:

while $i [box1name box2name box3name etc...]

send "ssh -l root $i"
expect "pass"
send "<passphrase>"
expect "~#"
send "apt-get update"
sleep 2
send "apt-get upgrade -y"
"sleep 2"
goto nextbox ;
exit

again, i am by no means a scripting/expect master, i would greatly appreciate some insight on this. i've searched google high and low, and yes even played with autoexpect but it didn't quite return the results desired.

thanks all.
 
Old 01-20-2004, 02:11 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Take a look at my LinuxAnswer on ssh and public key authentication. You should be able to do this without an expect script which will should save you time.
 
Old 01-20-2004, 02:28 PM   #3
jmr71769
Member
 
Registered: Jun 2003
Location: East Coast, USA
Distribution: Gentoo, Debian, Slack, FreeBSD
Posts: 82

Original Poster
Rep: Reputation: 15
thank you david

i thought your article was great... but... i'm still wondering, how does this take care of logging sequentially into 10 different machines and performing said tasks without actually being (t)here?

that's the part i'm missing. wouldn't i need a script to perform all the ssh'ing and apt-get'ing?

thank you again
 
Old 01-21-2004, 01:27 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
You probably will need a script to perform the installations but you shouldn't need an expect script to connect.

You could use a command like:
ssh root@server.yourdomain.com "wget -qO - http://www.yourdomain.com/update.sh | sh"

This will then download and execute your update.sh script from your webserver.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
expect scripts and cron banderson Linux - Software 8 05-27-2005 04:44 AM
Remote Admin IllEatUrHeart Mandriva 1 09-06-2004 05:52 PM
Remote Admin... kobe Linux - General 1 08-09-2002 08:52 AM
Remote admin? Ricardo77uk Linux - Networking 13 07-13-2001 01:05 PM
Remote admin. How? Q25 Linux - General 5 05-17-2001 03:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:11 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration