#!/usr/bin/perl
#
# Created by mearls
#
post_message@vermeer.org
#
# Hosts are valid ip or dns name of the device
# Set value of $Script to the expect script you would like to run
# Script needs to be in the same directory or change the path below
@hosts = qw(
server1
server2
server3
);
$Script="password.exp";
for $host (@hosts) {
print "\nRunning $Script on $host...\n";
open(SWITCH, "/usr/bin/expect ./$Script $host 2> /var/log/test.log |");
print "Completed $host. \n";
close(switch);
}
Then i would create the expect shell script.
to run the script chmod 755 ./name
if there are issues it should log to /var/log/test.log