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. |
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.
|
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 |
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. |
All times are GMT -5. The time now is 01:20 AM. |