shell项目-分发系统-expect
# chmod a+x 3.expect ; ./3.expect root 192.168.130.128 ls spawn ssh root@192.168.130.128root@192.168.130.128's password:
Last login: Wed Apr 25 08:32:02 2018 from 192.168.130.116
# ls
anaconda-ks.cfgcomzabbix-release-3.2-1.el7.noarch.rpm
# ./3.expect root 192.168.130.128 "ls;w;ps aux|grep sshd"
spawn ssh root@192.168.130.128
root@192.168.130.128's password:
Last login: Wed Apr 25 08:50:42 2018 from 192.168.130.116
# ls;w;ps aux|grep sshd
anaconda-ks.cfgcomzabbix-release-3.2-1.el7.noarch.rpm
08:52:15 up1:04,2 users,load average: 0.00, 0.01, 0.01
USER TTY FROM LOGIN@> root pts/0 192.168.130.1 07:48 15.00s0.01s0.01s -bash
root pts/1 192.168.130.11608:52 0.00s0.00s0.00s w
root 8260.00.4 1059964128 ? Ss 07:48 0:00 /usr/sbin/sshd -D
root 9470.00.5 1483165376 ? Ss 07:48 0:00 sshd: root@pts/0
root 10980.00.5 1483125504 ? Ss 08:52 0:00 sshd: root@pts/1
root 11180.00.0 112680 984 pts/1 S+ 08:52 0:00 grep --color=auto sshd
# #
页:
[1]