linux - bash 远程ssh 获取进程id并kill
大家讲道理
大家讲道理 2017-04-17 15:50:55
0
2
1002

现在有50台机器

想写一个bash,分别访问每台机器,kill掉相同的程序,并清空data文件夹内容,然后重启集群服务

这个bash要怎么写?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
小葫芦
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 it
Automatically log in to each server, and then the rest will be simple. .

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!