forked from itwanger/paicoding
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaunch.sh
48 lines (40 loc) · 1.22 KB
/
launch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
WEB_PATH="paicoding-web"
JAR_NAME="paicoding-web-0.0.1-SNAPSHOT.jar"
# 部署
function start() {
git pull
# 杀掉之前的进程
cat pid.log| xargs -I {} kill {}
mv ${JAR_NAME} ${JAR_NAME}.bak
mvn clean install -Dmaven.test.skip=True -Pprod
cd ${WEB_PATH}
mvn clean package spring-boot:repackage -Dmaven.test.skip=true -Pprod
cd -
mv ${WEB_PATH}/target/${JAR_NAME} ./
run
}
# 重启
function restart() {
# 杀掉之前的进程
cat pid.log| xargs -I {} kill {}
# 重新启动
run
}
function run() {
echo "启动脚本:==========="
echo "nohup java -server -Xms1g -Xmx1g -Xmn512m -XX:NativeMemoryTracking=detail -XX:-OmitStackTraceInFastThrow -jar ${JAR_NAME} > /dev/null 2>&1 &"
echo "==========="
# ms 堆大小 mx 最大堆大小 mn 新生代大小
nohup java -server -Dspring.devtools.restart.enabled=false -Xms1g -Xmx1g -Xmn256m -XX:NativeMemoryTracking=detail -XX:-OmitStackTraceInFastThrow -jar ${JAR_NAME} > /dev/null 2>&1 &
echo $! 1> pid.log
}
if [ $# == 0 ]; then
echo "miss command: start | restart"
elif [ $1 == 'start' ]; then
start
elif [ $1 == 'restart' ];then
restart
else
echo 'illegal command, support cmd: start | restart'
fi