Original: https://www.cnblogs.com/woms/p/6145688.html
Front start
Java-jar Xxx.jar
Background boot
Java-jar Xxx.jar &
Difference: The foreground starts CTRL + C will close the program, background boot CTRL + C will not close the program
Set standard output for the console
Java-jar Xxx.jar > Catalina.out
- Catalina.out point the standard output to the development file Catalina.out
- 2>&1 Output all log files
- & Background Launch
Script Start
#!/bin/sh# Feature Description: Start the jar file in the upper directory # parameter Description: # $1:jar file name (with suffix) # Note: The jar file must be located in the previous level directory of the startup.sh directory. #启动参数JAVA_OPTS = "-server-xms400m-xmx400m-xmn300m-xx:metaspacesize=128m-xx:maxmetaspacesize=128m-xverify:none-xx : +disableexplicitgc-djava.awt.headless=true "jar_name=$1this_dir=" $ (CD "$ (dirname" ) "&& pwd)" Parent_dir= ' DirName "${this_dir}" ' Log_dir= "${parent_dir}/logs" log_file= "${log_dir}/catalina.out" jar_file= "${ Parent_dir}/userapps/${jar_name} "#参数个数 <1 or parameter null value, interrupt execution if [$#-lt 1] | | [-z]; then echo-e "\033[31m Please enter the name of the jar package to be deployed!\033[0m" Exit 1fi# log folder does not exist, create if [!-D "${log_dir}"]; then mkdir "${ Log_dir} "fi# parent directory where the jar file exists if [-F" ${jar_file} "]; then #启动jar包; REDIRECT standard error output to file, discard standard output java $JAVA _opts-jar ${jar_file} 1>/dev/null 2> "${log_file}" & exit 0else echo-e "\033[31m${jar_file} file does not exist! \033[0m " exit 1fi
Starting mode
./startup.sh Xxx.jar
Description
Springboot Linux Boot Mode