zoukankan      html  css  js  c++  java
  • expect 使用说明

    tomcat1:/root/sbin# cat expect.exp 
    #!/usr/bin/expect
    spawn ssh root@192.168.32.169
    expect {
        "(yes/no)?" {
            send "yes
    "
            expect "assword:"
            send "1234567
    "
        }
            "assword:" {
            send "1234567
    "
        }
     }
    expect "#" 
    send "ls -ltr
    "
    send "exit
    "
    expect eof
    
    tomcat1:/root/sbin# expect expect.exp 
    spawn ssh root@192.168.32.169
    root@192.168.32.169's password: 
    Last login: Tue May 26 16:42:20 2015 from 192.168.32.169
    tomcat1:/root# ls -ltr
    total 48
    -rw-r--r--. 1 root root  7572 Jan 15 17:26 install.log.syslog
    -rw-r--r--. 1 root root 27312 Jan 15 17:27 install.log
    -rw-------. 1 root root  1342 Jan 15 17:27 anaconda-ks.cfg
    drwxr-xr-x  2 root root  4096 May 26 16:42 sbin
    tomcat1:/root# exit
    logout
    Connection to 192.168.32.169 closed.
    
    
    ---------------------------------------------------------------------
    tomcat1:/root/sbin# expect expect.exp 
    spawn ssh root@192.168.32.171
    The authenticity of host '192.168.32.171 (192.168.32.171)' can't be established.
    RSA key fingerprint is da:3a:61:09:e4:f6:46:d7:01:08:1a:6c:b9:41:e8:4c.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '192.168.32.171' (RSA) to the list of known hosts.
    root@192.168.32.171's password: 
    Last login: Mon May 25 15:09:25 2015 from 192.168.33.29
    flow:/root# ls -ltr
    total 44
    -rw-r--r--. 1 root root  7572 Jan 15 17:26 install.log.syslog
    -rw-r--r--. 1 root root 27312 Jan 15 17:27 install.log
    -rw-------. 1 root root  1342 Jan 15 17:27 anaconda-ks.cfg
    flow:/root# exit
    logout
    Connection to 192.168.32.171 closed.

  • 相关阅读:
    归一化与标准化区别
    pytorch进行mnist识别实战
    pytorch实现学习率衰减
    RNN
    Python中9大时间序列预测模型
    InfluxDB基本概念
    如何在CentOS 7上使用InfluxDB分析系统指标(转载学习用)
    InfluxDB1.2.4部署(centos7)
    Centos7搭建influxdb+chronograf
    python通过SNMP协议收集服务器监控信息
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351657.html
Copyright © 2011-2022 走看看