Once the build JAR package has deployed all the dependencies to Linux, you can start the Dubbo service, which is, of course, a prerequisite for Java's Linux environment to be deployed.
Dubbo service startup is very simple, if only a small number of service interfaces, the manual can be used for service maintenance
The commands to maintain are as follows:
Java-jar Xxx.jar &
Kill PID
Kill-9 PID
But when we use Dubbo this framework, the General Service is a lot of, if each service is manually to maintain, this work is too cumbersome, so we need a custom shell for service maintenance. Direct implementation of scripts Start,stop and restart
A shell instance is posted below for reference
#!/bin/sh## java envexport java_home=/usr/local/java/jdk1.7.0_72export jre_home= $JAVA _home/jre## service nameAPP_ name=userservice_dir=/home/li/test/service/$APP _nameservice_name=test-service-$APP _namejar_name= $SERVICE _name\ . jarpid= $SERVICE _NAME\.PIDCD $SERVICE _dircase "$" in start) nohup $JRE _home/bin/java-xms256m-xmx512m-jar $JA R_name >/dev/null 2>&1 & Echo $! > $SERVICE _dir/$PID echo "= = = Start $SERVICE _name";; stop) Kill ' cat $SERVICE _dir/$PID ' rm-rf $SERVICE _dir/$PID echo "= = = Stop $SERVICE _name" Slee P 5#### test-service-aa.jar## test-service-aa-bb.jar p_id= ' Ps-ef | Grep-w "$SERVICE _name" | Grep-v "grep" | awk ' {print $} ' if ["$P _id" = = ""]; then echo "= = = $SERVICE _name process not exists or stop success" else echo "= = = = $SERVICE _name Process pid is: $P _id "echo" = = = Begin Kill $SERVICE _name process, PID is: $P _id "Kill-9 $P _id fi;; Restart) $ Stop Sleep 2 $ start echo "= = = Restart $SERVICE _name";; * # Restart $ stop sleep 2 $ start;; Esacexit 0
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Dubbo Summary (5)--linux maintenance of Dubbo