Shell项目之分发系统-expect(下)
# sh -x exe.sh ++ cat ip.list+ for ip in '`cat ip.list`'
+ echo 116.62.xxx.xxx
116.62.xxx.xxx
+ ./exe.expect 116.62.xxx.xxx 'w;free -m;ls /tmp'
spawn ssh root@116.62.xxx.xxx
root@116.62.xxx.xxx's password:
Last login: Tue May1 09:06:02 2018 from 117.80.xxx.xxx
Welcome to Alibaba Cloud Elastic Compute Service !
# w;free -m;ls /tmp
10:42:43 up2:44,3 users,load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@> root pts/0 117.60.xxx.xxx08:01 2:01m0.00s0.00s -bash
root pts/1 117.80.xxx.xxx 09:06 13:47 0.00s0.00s -bash
root pts/2 117.80.xxx.xxx 10:42 0.00s0.00s0.00s w
total used free sharedbuff/cache available
Mem: 1839 63 1403 0 372 1628
Swap: 0 0 0
12.txt
Aegis-
systemd-private-791e0c77625c4133bda4340fcd191439-ntpd.service-mZ3IQT
# + for ip in '`cat ip.list`'
+ echo 127.0.0.1
127.0.0.1
+ ./exe.expect 127.0.0.1 'w;free -m;ls /tmp'
spawn ssh root@127.0.0.1
root@127.0.0.1's password:
Last failed login: Tue May1 10:01:00 CST 2018 from localhost on ssh:notty
There were 2 failed login attempts since the last successful login.
Last login: Tue May1 09:06:00 2018 from 192.168.72.1
# w;free -m;ls /tmp
10:42:43 up7:26,3 users,load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@> root pts/0 192.168.72.1 07:52 1:59m0.44s0.44s -bash
root pts/1 192.168.72.1 09:06 3.00s2.19s0.01s /usr/bin/expect ./exe.expect 127.0.0.1 w;
root pts/3 localhost 10:42 0.00s0.04s0.00s w
total used free sharedbuff/cache available
Mem: 1823 243 1114 17 465 1364
Swap: 3813 0 3813
12.txt
ip.list
list.txt
php-fcgi.sock
systemd-private-59132022d890457896ed0047dcd941fe-cups.service-rfy8W2
systemd-private-59132022d890457896ed0047dcd941fe-httpd.service-h5dZDM
systemd-private-59132022d890457896ed0047dcd941fe-vmtoolsd.service-iZ3m2r
tmp
xavier.sock
页:
[1]