标签:
ip="192.168.5.166"
ssh $ip -o StrictHostKeyChecking=no //ssh登陆不用输入"yes"
port="26092"
pid=`netstat -anlp|grep $port|awk ‘{print $7}‘|awk -F"/" ‘{print $1}‘`
pname=`ps -ef|grep $pid|grep -v grep|awk ‘{print $NF}‘`
dir=`find /var/daemon/ -name $pname |grep -v bak|sed -r -e "s#/$pname##"`
yes=`jps -l|grep $pname`
if [ $? -eq 0 ];then
echo $dir
echo $pname
fi
<1>
find /var/daemon/ -name $pname |grep -v bak|sed -r -e "s#/$pname##"
/var/daemon/doc/index
<2>
find /var/daemon/ -name $pname -exec dirname {} \;|grep -v bak
/var/daemon/doc/index
标签:
原文地址:http://www.cnblogs.com/itcomputer/p/4643047.html