首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

运用脚本启动停止JAVA程序

2012-07-15 
使用脚本启动停止JAVA程序#!/bin/bashAPP_MAINCLASScom.jna.JanServerAPP_START_SCRIPT/opt/com/jna/run

使用脚本启动停止JAVA程序

#!/bin/bashAPP_MAINCLASS=com.jna.JanServerAPP_START_SCRIPT=/opt/com/jna/runJnastop(){javaps=`ps -ef|grep -v "\<grep\>"|grep com.jna.JanServer|awk '{print $2}'`for v in $javaps;do  echo "stop elm server,process id: "$v;  kill -9 $v;done}start(){    RESULT=`ps -ef|grep -v "\<grep\>"|grep com.jna.JanServer`       if [ -z "$RESULT" ];then   $APP_START_SCRIPT;else  echo "Elm Server already running";fi}case "$1" instart)start    ;;stop)stop    ;;restart)stopsleep 2start;;*)    echo "Usage: $prog {start|stop|restart}"    exit 1esac

热点排行