标签:
在SunOS 5.10测试通过。
#!/bin/bash
procinfo=`ps -ef | grep "java" | grep -v "grep"`
if [ $? -eq 0 ]
then
echo $procinfo | while read line
do
tomcatuid=`echo $line | awk ‘{print $1}‘`
tomcatpid=`echo $line | awk ‘{print $2}‘`
tomcatarg=`pargs $tomcatpid | grep "catalina.home"`
if [ $? -eq 0 ]
then
tomcathome=`echo $tomcatarg | awk -F‘=‘ ‘{print $2}‘`
tomcatver="$tomcathome/bin/version.sh"
if [ -f $tomcatver ]
then
luser=`logname`
if [ $luser = $tomcatuid ]
then
$tomcatver
else
su - $tomcatuid -c "$tomcatver"
fi
else
echo "can not find $tomcathome/bin/version.sh"
fi
fi
done
fi
标签:
原文地址:http://my.oschina.net/h2do/blog/405038