Springboot Basic Summary and Java System deployment script usage

Source: Internet
Author: User

Springboot Study Comparison Summary: HTTPS://PAN.BAIDU.COM/S/1DYWVPK


Java System deployment script:

when you want to put the program in the background to run: nohup./your_command &

Deploy Java:

1. using maven to package projects on eclipse: Clean Packages

2. find a working directory:E:\work\mywork\ad_logsIndex\target

3. Copy two files to a directory in Linux (I use the filezilla tool to copy files), and write the startup script

#!/bin/bash prog=logsindexjava_home=/usr/java/jdk1.8.0_144prog_dir=/opt/webapps/logsindex   Start ()  {    echo -n $ "starting  $prog: "      cd  $prog _dir    screen -dms  $prog   $JAVA _home/bin/java -jar - xms2048m -xmx4096m  $prog _dir/ad_logsindex-0.0.1-snapshot.jar com.voole.ad.main.startup - djava.ext.dirs= $prog _dir/lib    retval=$?    echo     [  $retval  -eq 0 ]    return  $retval} stop ()  {     echo -n $ "stopping  $prog: "     killproc $ prog    retval=$?    echo    [  $retval  - eq 0 ]    return  $retval} case  "$"  in     start)         $1        ;;     stop)         $1         ;;     *)         echo $ "Usage: $0 { Start|stop} "        exit 2esac




4. Modify Permissions:

# chmod A+x Ad_logsindex-0.0.1-snapshot.jar

# chmod A+x start.sh

5. Start

[[email protected] logsindex]#./start.sh start

Starting Logsindex:

6. Stop the Service

Method One:

[[email protected] logsindex]#./start.sh stop

Note: The Logsindex name is configured in the script (Prog=logsindex)

Method Two :

# Ps-ef | grep logsindex

The process is then cut through the KILL command + process number.

Method Three:

# Screen-r Logsindex

Ctrl+a+d: Exit without stopping the process

CTRL + C: Exit process


Other scripts seen:

#!/bin/sh## chang hereservice_dir=/roncoo/spring-boot-demoservice_name= spring-boot-demo-31-1-0.0.1-snapshotspring_profiles_active=dev## java envexport java_home=/opt/ jdk1.7.0_79export jre_home=${java_home}/jrecase  "$"  in start) procedure= ' ps -ef  | grep -w  "${service_name}"  |grep -w  "java" | grep -v  "grep"   | awk  ' {print $2} ' if [  ' ${procedure} '  =  '  ];thenecho  ' start &nbsp "if [ " " != " " ];thenSPRING_PROFILES_ACTIVE=$2fiecho " Spring.profiles.active=${spring_profiles_active} "exec nohup ${jre_home}/bin/java -xms128m  -xmx512m -jar ${service_dir}/${service_name}\.jar --spring.profiles.active=${spring_profiles_ active} >/dev/null 2>&1 &echo  "start success" elseecho  "${SERVICE_ Name} is start "FI;; Stop) procedure= ' ps -ef | grep -w  "${service_name}"  |grep -w  "java" | grep -v  "grep"  | awk  ' {print $2} ' if [  ' ${procedure} '  =  '  ];thenecho  ' ${ Service_name} is stop "Elsekill -9 ${procedure}sleep 1argprocedure= ' ps -ef |  grep -w  "${service_name}"  |grep -w  "java" | grep -v  "grep"  |  awk  ' {print $2} ' if [  ' ${argprocedure} '  =  '  ];thenecho  ' ${ Service_name} stop success "elsekill -9 ${argprocedure}echo " ${SERVICE_NAME} stop  error "FIFI;; Restart) $0 stopsleep 1$0 start $2;;   *) echo  "Usage: $0 [start|stop|restart] [dev|test|prod]";;   esac


Springboot Basic Summary and Java System deployment script usage

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.