In the previous article “SpringBoot(9) Schedule”, we have introduced the configuration and use of the Schedule framework in detail. I have received some private messages from friends about deployment, so I took the time to compile a tutorial on Linux deployment Schedule.

V Preparing scripts

Shell script is not much introduction, deployment jar package online a pile of search, directly posted script.

#! Run./test.task.sh enter 1, 2, 3 # 2: Perform run. / test. Task. Sh start | stop | restart BIZ_NAME = "test_demo_task" # business name (English, Numbers, underline) JAR_NAME = "demo - 0.0.1 - the SNAPSHOT. Jar" # JAR_ARGS="export" # jar package startup parameter PID_PATH="/var/srv/test/" # PID path start(){if [! -d $PID_PATH] then mkdir -p $PID_PATH chmod 777 -r $PID_PATH fi JAVA_OPTS=" -xmx512m -xms64m -xmn32m -xss256K "echo" start service..." nohup java -jar "$(cd `dirname $0`; pwd)/$JAR_NAME" $JAR_ARGS $JAVA_OPTS & echo $! >"${PID_PATH}_${BIZ_NAME}. Pid "echo" start service success..." } stop(){ echo "stop service ..." kill `cat "${PID_PATH}_${BIZ_NAME}.pid"` rm -rf "${PID_PATH}_${BIZ_NAME}.pid" echo "stop service end ..." } restart(){ stop sleep 3 start } if [ -n "$1" ] then case "$1" in "start") start ;; "stop") stop ;; "restart") restart ;; *) echo 'You do not input a run param' ;; esac else if read -n 1 -t 10 -p "User Command: {start:1|stop:2|restart:3}" input then case $input in 1) start ;; 2) stop ;; 3) restart stop ;; *) echo 'You do not select a number between 1 to 3' ;; esac else echo "timeout ,please retry ..." fi fi exit 0Copy the code

V deployment Schedule

1.0 packaging

2.0 Upload package and script files

Rz-y or sudo rZ-y select file

3.0 Scripts add executable attributes

chmod +x *.sh

4.0 Executing Scripts

View the output less nohup.out

Log output has been the shortcut key Shift+F

Ps – view the process ef | grep name

V Source code address

Github.com/toutouge/ja…

About the author: Focus on basic platform project development. If you have any questions or suggestions, please feel free to comment! Copyright notice: The copyright of this article belongs to the author and the blog garden, welcome to reprint, but without the consent of the author must retain this statement, and give the original text link in a prominent place on the page of the article. For the record: all comments and messages will be answered as soon as possible. You are welcome to correct your mistakes and make progress together. Or direct private message I support the blogger: if you think the article is helpful to you, you can click on the lower right corner of the article [recommendation]. Your encouragement is the author to adhere to the original and continuous writing of the biggest power! \