zoukankan      html  css  js  c++  java
  • shell java应用启动脚本(app.sh)

    #!/bin/sh

    # java服务中需要的jar文件或classpath路径,如业务程序、第三方jar文件log4j等

    ShellAbsPath=$(cd "$(dirname "$0")"; pwd)
    BinDir=`dirname $0`
    AppName=`basename $0`
    AppName=${AppName%.*}

    ClassPath=""
    WorkPath=$(cd "$(dirname "$0")"; pwd)
    RunPath=${WorkPath}/config

    ClassName="com.alter.Application"

    function getLibs(){
    for file in $1/*.jar
    do
    ClassPath=$file:$ClassPath
    done
    }

    function addPath(){
    LibPath=$1:$LibPath
    }

    function start(){
    cd ${RunPath}
    #java -server -Xms1024m -Xmx1024m -XX:+UseParallelGC -XX:-UseGCOverheadLimit -classpath ${ClassPath} -Djava.library.path=${ClassPath} ${ClassName} >&1 &
    java -server -Xms256m -Xmx256m -XX:+UseParallelGC -XX:-UseGCOverheadLimit -classpath ${ClassPath} -Djava.library.path=${ClassPath} ${ClassName} >/xxx-xx/config/log/log.log &
    }

    function stop(){
    ps -aef| grep ${WorkPath} |grep -v grep|awk '{print $2}'|xargs kill -9
    }

    function status(){
    ps -aef|grep $ClassName|grep ${WorkPath}|grep -v grep

    }

    getLibs ${ShellAbsPath}/lib
    getLibs ${ShellAbsPath}/applib

    case "$1" in
    start)
    start
    status
    ;;
    stop)
    stop
    ;;
    restart|reload)
    stop
    start
    ;;
    status)
    status
    ;;
    *)
    echo $"Usage: $0 {start|stop|restart|reload|status}"
    exit 1
    esac

    exit 0;

  • 相关阅读:
    codevs 1199 开车旅行 2012年NOIP全国联赛提高组
    poj 3349 Snowflake Snow Snowflakes
    poj 3264 Balanced Lineup
    求二进制数中1的个数
    20个正则表达式,减少千行代码
    推流脚本
    Navicat 管理工具下载地址,破解版
    emoji表情处理研究
    计算机网络学习
    tcp/ip 学习-通过视频学习
  • 原文地址:https://www.cnblogs.com/alter888/p/8985642.html
Copyright © 2011-2022 走看看