码迷,mamicode.com
首页 > 系统相关 > 详细

从solaris进程获取tomcat安装路径

时间:2015-04-22 16:30:45      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:

在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


从solaris进程获取tomcat安装路径

标签:

原文地址:http://my.oschina.net/h2do/blog/405038

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!