-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chroe: enable springboot app autostart * chroe: enable springboot app autostart * chroe: enable springboot app autostart * chroe: enable springboot app autostart * chroe: enable springboot app autostart * chroe: enable springboot app autostart * chroe: enable springboot app autostart * chroe: enable springboot app autostart --------- Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
8e13f56
commit 44f4162
Showing
2 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,32 @@ | ||
#!/bin/bash | ||
|
||
JAR_FILE=hellospring2x-0.0.1-SNAPSHOT.jar | ||
DIR=${1:-/home/migrateadmin} | ||
JAR_FILE=$DIR/hellospring2x-0.0.1-SNAPSHOT.jar | ||
sudo apt update | ||
sudo apt install openjdk-11-jre-headless | ||
|
||
if [ ! -f "$JAR_FILE" ]; then | ||
echo "$JAR_FILE does not exist, download from remote" | ||
curl -o $JAR_FILE https://raw.githubusercontent.com/Azure/discover-java-apps/main/mock/hellospring2x-0.0.1-SNAPSHOT.jar | ||
fi | ||
JAVA_OPTS_2x="-XX:InitialRAMPercentage=40.0 -XX:MaxRAMPercentage=40.0 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.local.only=true -Dmanagement.endpoints.jmx.exposure.include=healthmetrics -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -DtestOption=abc=def -Dspring.jmx.enabled=true -Dserver.tomcat.mbeanregistry.enabled=true -Dfile.encoding=UTF8 -Dspring.config.import=optional:configserver:/ -Dspring.datasource.password=testpassword1234" | ||
nohup java $JAVA_OPTS_2x -jar $JAR_FILE > app.log 2>&1 & | ||
|
||
# start springboot app | ||
tee $DIR/startApp.sh << END | ||
#!/bin/bash | ||
java -XX:InitialRAMPercentage=40.0 -XX:MaxRAMPercentage=40.0 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.local.only=true -Dmanagement.endpoints.jmx.exposure.include=healthmetrics -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -DtestOption=abc=def -Dspring.jmx.enabled=true -Dserver.tomcat.mbeanregistry.enabled=true -Dfile.encoding=UTF8 -Dspring.config.import=optional:configserver:/ -Dspring.datasource.password=testpassword1234 -jar $JAR_FILE | ||
END | ||
|
||
chmod +x $DIR/startApp.sh | ||
nohup $DIR/startApp.sh 2>&1 & | ||
|
||
# Enable auto start | ||
sudo tee /lib/systemd/system/springboot.service << END | ||
[Unit] | ||
Description=Start springboot application | ||
[Service] | ||
ExecStart=$DIR/startApp.sh | ||
[Install] | ||
WantedBy=multi-user.target | ||
END | ||
sudo systemctl enable springboot.service --now |