通过shell脚本,在批量服务器上执行相同脚本,简单记录下
#!/bin/bash
iplist=(192.168.174.132 192.168.174.133 192.168.174.134)
for ip in ${iplist[*]}
do
nohup ssh wfq@$ip "cd; mkdir test07;cd test07; touch 007.log;echo '$ip log create done';exit;"&
echo $ip
done
执行结果
wfq@ubuntu:~/sbin/shell$ ./update_softlink.sh
192.168.174.132
192.168.174.133
192.168.174.134
wfq@ubuntu:~/sbin/shell$ cat nohup.out
192.168.174.133 log create done
192.168.174.132 log create done
192.168.174.134 log create done
本文介绍了一种使用Shell脚本的方式,在多个服务器上批量执行相同的脚本任务。具体操作包括远程连接各服务器,并在其上创建指定目录、文件等。该方法能够有效提高运维效率。
8738

被折叠的 条评论
为什么被折叠?



