- Java jar close startup script
#!/bin/sh
RESOURCE_NAME=maf.jar
CONFIG_PATH=/maf/maf-service
#Stop
tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Stop Process...'
kill -15 $tpid
fi
sleep 5
#Closed
tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Kill Process!'
kill -9 $tpid
else
echo 'Stop Success!'
fi
tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'App is running.'
else
echo 'App is NOT running.'
fi
rm -f tpid
nohup java -Dspring.config.location=$CONFIG_PATH/application.properties -jar $RESOURCE_NAME > nohup.out 2>&1 &
echo $! > tpid
echo Start Success!
tail -f nohup.out
Note: 1. -dspring.config. location: Specify the configuration file
For yML type configuration files, you simply place them in the sibling directory of the JAR without specifying them
2. Grep -v Grep eliminates the row
Dlogging.config=/data/apps/maf/ maf-Yunyan /logback.xml
Read More:
- The remote port occupation of Linux startup jar package script reports an error
- Windows Java application startup batch script
- Raspberry pie startup self startup opencv program script and error analysis
- Java cpp-0.11.jar, opencv-windows-x86_ 64.jar,opencv-2.4.11-0.11.jar
- RabbitMQ Startup Script (How to Set)
- Depending on the custom component jar package, unable to read meta data for class appears after startup
- Zend studio HTML error prompt close, PHP “error prompt” open and close the correct way
- [solution] the resource file cannot be found in the jar package of Java
- Eclipse startup error: a Java runtime environment (JRE) or Java Development Kit (JDK) must be available
- Tomcat startup project warning: org.apache.jasper.servlet.tldscanner.scanjars at least one jar has been scanned for TLD but does not contain TLD
- [Solved] Tomcat9 Startup Error: Failed creating Java ‘XXXX\Java\jdk1.8\jre\bin\server\jvm.dll‘.
- zookeeper Failed to Startup: Error: JAVA_HOME is not set and java could not be found in PATH
- Zip to decompress the jar package, like the add file in the jar package
- Unity3d mount script error “can’t add script behavior TMP”_ CoroutineTween. …”
- How to select the jar package version for Maven package when the jar package versions referenced by multiple modules are inconsistent
- Centos7 view and close firewall
- Does the version of idea2020.1 import mybayis jar package or report an error? Error: (4,28) Java: package org.apache.ibatis.io does not exist
- Namenode startup error: outofmemoryerror: Java heap space
- Research on Maven management of Java project pom.xml The jar package error is reported, but the project is running normally
- [Solved] nacos Startup Error: java.io.IOException…