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"
/var/lib/openshift/bccd8eac1968476490eaee9ced33c7bf/app-root/runtime/repo/php/data/pages/expect.txt · 最后更改: 2012/09/07 09:21 (外部编辑)
到顶部
CC Attribution-Noncommercial-Share Alike 3.0 Unported
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0