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;

  • 相关阅读:
    [Json.net]忽略不需要的字段
    [c#]exchange回复,全部回复,转发所遇到的问题
    [c#]获取exchange中的图片
    [c#基础]AutoResetEvent
    [C#基础]c#中的BeginInvoke和EndEndInvoke
    [CentOs7]安装mysql
    [CentOS7]安装mysql遇到的问题
    [CentOs7]图形界面
    [CentOS]添加删除用户
    在虚机中安装CentOS
  • 原文地址:https://www.cnblogs.com/alter888/p/8985642.html
Copyright © 2011-2022 走看看