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

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

#!/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
发布了190 篇原创文章 · 获赞 169 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_44799645/article/details/105220855