linux 执行远程命令

#!/bin/bash

base=/home/mc
ps aux | grep message | grep -v grep | awk '{print $2}' | xargs kill -9
echo "mc stop!"

#停止slaves
cat $base/config/slaves | while read line
do

ssh root@$line  > /dev/null 2>&1  << beginremote
ps aux | grep person | grep -v grep | awk '{print $2}' | xargs kill -9     
beginremote
echo "$line pr stop!"
done

你可能感兴趣的:(linux)