Expect

确认crontab内容

#!/usr/bin/expect 
#ver 0.2 by gavin 
set hostname [lindex $argv 0] 
send_user "\n\n<--------------  check $hostname START -------------->\n\n" 
spawn ssh $hostname 
expect "*~]$" 
send "su -\r" 
expect "Password:" 
send "password\r" 
expect "*~]#" 
send "crontab -l\r" 
expect "*~]#" 
send_user "\n\n<--------------  check $hostname END -------------->\n\n" 
expect eof 
close 
exit
#!/usr/bin/expect 
puts "Hello World" 
log_user 0 
spawn ping -c 2 -i 3 -W 1 10.40.0.1 
 
expect { 
        " 0%" {puts "I'm fully alive matee"} 
        " 100%" {puts "Not a sausage"} 
        } 
puts "done"
/home1/yepnnet/public_html/wiki/data/pages/expect.txt · 最后更改: 2010/05/12 22:55 由 admin
到顶部
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0