disconf Java Boot shell

Source: Internet
Author: User

1. startup file: service-restart.sh

#!/bin/sh # java ENV source/etc/profile export java_home=/usr/local/jdk1.7.0_75 export jre_home= $JAVA _home/jre if [$# != 3]; 
Then echo "USAGE: $ service_dir service_name_pre disconf_env" echo "e.g.: $0/opt/dubbo-test Dubbo-goods Rd" Exit 1; Fi service_dir=$1 service_name_pre=$2 #设置 disconf information disconf_env=$3 disconf_host=192.168.0.11:8080 DISCONF_APP=dubbo DI sconf_version=1.0.0 echo "Service_dir" $SERVICE _dir echo "Service_name_pre" $SERVICE _name_pre echo "Disconf_env" $ Disconf_env echo "Disconf_host" $DISCONF _host echo "Disconf_app" $DISCONF _app echo "disconf_version" $DISCONF _version CD $SERVICE _dir # p_id= ' Ps-ef | Grep-w "$SERVICE _name_pre" | Grep-v "grep" | awk ' {print $} ' p_id= ' Jps-ml|grep ' $SERVICE _name_pre ' |awk ' {print '} ' if [' $P _id ' = '];  then echo "= = = $SERVICE _name process not exists or stop success" else echo "= = Begin Kill
       $SERVICE _name process, PID is: $P _id "Kill-9 $P _idFi sleep 3 jar_name= ' ls-rt *.jar|grep-v ' sources ' |tail-1 ' echo ' START jar_name ' $JAR _name nohup $JRE _home/bin/java-xms256m-xmx512m-jar-ddisconf.env= $DISCONF _env-ddisconf.conf_server_host= $DISCONF _host- ddisconf.app= $DISCONF _app-ddisconf.version= $DISCONF _version-ddisconf.user_define_download_dir=.classes- Ddisconf.enable.remote.conf=true $JAR _name > $SERVICE _name_pre.log 2>&1 & ls *.jar|grep-v $JAR

 _name|xargs RM-RF Exit 0

2. Examples:
2.1. The first parameter is the directory where the executable jar file resides
2.2. The second parameter is the executable jar file name
2.3. The third parameter is the name of the environment

/opt/service-restart.sh/opt/test-service Test-service Rd

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.