Hi I appreciate this is OT but could someone just give me a little advice, I've written this script to logon on each server then restart the ntpd daemon. The problem I have is it only restarts the daemon for the last server provided in the list, any ideas as to why and how to fix it?
#!/usr/bin/expect -f set argc [llength $argv] for {set i 0} {$i<$argc} {incr i} { puts "arg $i: [lindex $argv $i]" set var1 [lindex $argv $i] spawn scp /etc/ntp.conf "r...@$var1:/etc/" spawn ssh r...@$var1 "/etc/init.d/ntpd restart" } ####################### expect { -re ".*es.*o.*" { exp_send "yes\r" exp_continue } -re ".*sword.*" { exp_send "<password>\r" } } interact When run I get the following: ./test.expect server1 server2 arg 0: server1 spawn scp /etc/ntp.conf r...@server1:/tmp/ spawn ssh r...@server1 /etc/init.d/ntpd restart arg 1: server2 spawn scp /etc/ntp.conf r...@server2:/tmp/ spawn ssh r...@server2 /etc/init.d/ntpd restart r...@server2's password: Shutting down ntpd: [ OK ] Starting ntpd: [ OK ] Any ideas? Thanks for any help. Dan -- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines