以syslog为例
- ssh [email protected] eval "ps -ef | grep [s]yslog | cut -c 10-14|xargs kill -s 9"
- ssh [email protected] pkill -9 syslog
- 在远程主机上编辑好脚本,vim /tmp/kill.sh
[email protected] ~$cat /tmp/kill.sh
#!/bin/bash
kill -s 9 `ps -ef | grep [s]yslog | awk ‘{print $2}‘`接着在本地主机执行即可
ssh [email protected] "/tmp/kill.sh"
时间: 2024-10-22 22:57:02