Springboot Linux Boot Mode

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.