现在有50台机器
想写一个bash,分别访问每台机器,kill掉相同的程序,并清空data文件夹内容,然后重启集群服务
这个bash要怎么写?
光阴似箭催人老,日月如移越少年。
fori(ip): ssh -n -T $ip/$hostname 'ps -ef|grep ${your process}|awk '{print $2}|xargs kill -9 && rm ${your data's path}' ssh ${your master machine} '${run restart.sh}'
Just use expectto implement itAutomatically log in to each server, and then the rest will be simple. .
expect
Just use
expect
to implement itAutomatically log in to each server, and then the rest will be simple. .