循环关闭局域网中所有主机的脚本

循环关闭局域网中所有主机
#!/bin/bash
#假设本机为 192.168.4.100,编写脚本关闭除自己外的其他所有主机
#脚本执行,需要提前给所有其他主机传递 ssh 密钥,满足无密码连接
for i in {1..254}
do
[ $i -eq 100 ] && continue
echo "正在关闭 192.168.4.$i..."
ssh 192.168.4.$i
poweroff
done

猜你喜欢

转载自blog.51cto.com/13735155/2134296
今日推荐