shell脚本

匆匆过客 提交于 2019-12-12 17:21:31

【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>

#!/usr/bin/env bash
JAR_FILE_NAME="donkey-acl-console.war"

findproc() {
        PID=`ps aux | grep $JAR_FILE_NAME | grep "java" | grep -v "$$" | grep -v grep | awk '{ print $2 }'`
}

findproc;

echo 'find process id : '$PID

for i in $PID
do
   /bin/kill -9 $PID
done

cd `dirname $0`
cd ..
DEPLOY_DIR=`pwd`

JAVA='java'
if [ -z `which java` ]; then
    if [ -z $JAVA_HOME ];
        then
            JAVA=$JAVA_HOME/bin/java
        else
            echo 'Cannot find java command and JAVA_HOME.'
    fi
fi

if [ ! -z `java -version 2>&1 | grep 'openjdk version' | awk '{print $3}' | egrep '1.[8-10].\d*'` ]; then
    nohup $JAVA -Xms512m -Xmx1024m -jar $DEPLOY_DIR/lib/$JAR_FILE_NAME --spring.config.location=$DEPLOY_DIR/config/application.yml  >/dev/null 2>&1 &
    echo 'Job Server has been started successfully.'
    echo 'You can see more details in logs/*.'
else
    echo 'Java version not support, must be 1.8 or 1.8+.'
fi
#!/usr/bin/env bash
JAR_FILE_NAME="donkey-acl-console.war"

cd `dirname $0`
cd ..

DEPLOY_DIR=`pwd`

JAVA='java'
if [ -z `which java` ]; then
    if [ -z $JAVA_HOME ];
        then
            JAVA=$JAVA_HOME/bin/java
        else
            echo 'Cannot find java command and JAVA_HOME.'
    fi
fi

if [ ! -z `java -version 2>&1 | grep 'openjdk version' | awk '{print $3}' | egrep '1.[8-10].\d*'` ]; then
    nohup $JAVA -Xms512m -Xmx1024m -jar $DEPLOY_DIR/lib/$JAR_FILE_NAME --spring.config.location=$DEPLOY_DIR/config/application.yml  >/dev/null 2>&1 &
    echo 'Job Server has been started successfully.'
    echo 'You can see more details in logs/*.'
else
    echo 'Java version not support, must be 1.8 or 1.8+.'
fi
#!/usr/bin/env bash
JAR_FILE_NAME="donkey-acl-console.war"

findproc() {
        PID=`ps aux | grep $JAR_FILE_NAME | grep "java" | grep -v "$$" | grep -v grep | awk '{ print $2 }'`
}

findproc;

echo 'find process id : '$PID

for i in $PID
do
   /bin/kill -9 $PID
done
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!