diff options
Diffstat (limited to 'apiroute/apiroute-standalone/src/assembly/resource')
15 files changed, 379 insertions, 0 deletions
diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/apirouteService.exe b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/apirouteService.exe Binary files differnew file mode 100644 index 0000000..c6e8fc2 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/apirouteService.exe diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/apirouteService.xml b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/apirouteService.xml new file mode 100644 index 0000000..f885a95 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/apirouteService.xml @@ -0,0 +1,13 @@ +<service>
+ <id>msb_apiroute</id>
+ <name>msb_apiroute</name>
+ <description>This service runs apiroute.</description>
+ <workingdirectory>%BASE%</workingdirectory>
+ <env name="JAVA_HOME" value="c:\jdk"/>
+ <env name="RUNHOME" value="%BASE%"/>
+ <executable>java</executable>
+ <arguments>-jar "apiroute-service.jar" server "conf/apiroute.yml"</arguments>
+ <stopexecutable>stop.bat</stopexecutable>
+ <logmode>rotate</logmode>
+ <!-- stopparentprocessfirst>true</stopparentprocessfirst -->
+</service>
\ No newline at end of file diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/conf/apiroute.yml b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/conf/apiroute.yml new file mode 100644 index 0000000..172fae3 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/conf/apiroute.yml @@ -0,0 +1,52 @@ +defaultWorkspace: ../apiroute-works
+
+defaultName: ${DW_DEFAULT_NAME:-Stranger}
+
+propertiesName: redis.properties
+propertiesDir: conf
+
+# use the discover config if you want to monitor a discover service and register microservices change
+discoverInfo:
+ ip: 127.0.0.1
+ port: 10081
+ enabled: false
+
+consulInfo:
+ ip: 127.0.0.1
+ port: 8500
+
+# use the simple server factory if you only want to run on a single port
+server:
+ type: simple
+ rootPath: '/api/microservices/v1/*'
+ applicationContextPath: /
+ adminContextPath: /admin
+ connector:
+ type: http
+ port: 8086
+
+# Logging settings.
+logging:
+
+ # The default level of all loggers. Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL.
+ level: ALL
+
+ # Logger-specific levels.
+ loggers:
+
+ # Sets the level for 'com.example.app' to DEBUG.
+ com.example: DEBUG
+
+ appenders:
+ - type: console
+ threshold: INFO
+ timeZone: UTC
+ logFormat: "%-6level [%d{HH:mm:ss.SSS}] [%t] %logger{5} - %X{code} %msg %n"
+ - type: file
+ threshold: INFO
+ logFormat: "%-6level [%d{HH:mm:ss.SSS}] [%t] %logger{5} - %X{code} %msg %n"
+ currentLogFilename: ../apiroute-works/logs/application.log
+ archivedLogFilenamePattern: ../apiroute-works/logs/application-%d{yyyy-MM-dd}-%i.log.gz
+ archivedFileCount: 7
+ timeZone: UTC
+
diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initServices/msb.json b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initServices/msb.json new file mode 100644 index 0000000..e493556 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initServices/msb.json @@ -0,0 +1,29 @@ +[{
+ "serviceName" : "microservices",
+ "version" : "v1",
+ "url" : "/api/microservices/v1",
+ "apiJson" : "/api/microservices/v1/swagger.json",
+ "apiJsonType" : "1",
+ "metricsUrl" : "/admin/metrics",
+ "control" : "1",
+ "status" : "1",
+ "servers" : [{
+ "ip" : "127.0.0.1",
+ "port" : "8086",
+ "weight" : 0
+ }
+ ]
+ },
+{
+ "serviceName" : "microservices",
+ "url" : "/iui/microservices",
+ "control" : "1",
+ "status" : "1",
+ "servers" : [{
+ "ip" : "127.0.0.1",
+ "port" : "8086",
+ "weight" : 0
+ }
+ ]
+ }
+]
diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initServices/readme.txt b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initServices/readme.txt new file mode 100644 index 0000000..59ef5e4 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initServices/readme.txt @@ -0,0 +1,63 @@ +########################## initialize default routeInfo to redis ##########################
+
+#when msb is starting, it will automatically read all json files under this folder, and initializes to redis.
+#If the routeInfo is exist, it will be ignored, otherwise it will be saved.
+
+
+# JSON File content must be routeInfo format array like below examples:
+
+# optional:
+# apiJsonType: 1:user-defined json type 0:pre-defined json type
+# control: 0:default 1:readonly 2:hidden
+# status: 0:disabled 1:enabled
+# Tip£ºcontrol¡¢status¡¢weight are non-mandatory
+
+[
+##########################apiRoute example##########################
+
+{
+ "serviceName" : "microservices",
+ "version" : "v1",
+ "url" : "/api/microservices/v1",
+ "apiJson" : "/api/microservices/v1/swagger.json",
+ "apiJsonType" : "1",
+ "metricsUrl" : "/admin/metrics",
+ "control" : "1",
+ "status" : "1",
+ "servers" : [{
+ "ip" : "127.0.0.1",
+ "port" : "8086",
+ "weight" : 0
+ }
+ ]
+ },
+
+##########################iuiRoute example##########################
+
+{
+ "serviceName" : "microservices",
+ "url" : "/iui/microservices",
+ "control" : "1",
+ "status" : "1",
+ "servers" : [{
+ "ip" : "127.0.0.1",
+ "port" : "8086",
+ "weight" : 0
+ }
+ ]
+ },
+
+##########################customRoute example##########################
+ {
+ "serviceName" : "/test",
+ "url" : "/test",
+ "control" : "0",
+ "status" : "1",
+ "servers" : [{
+ "ip" : "10.74.56.36",
+ "port" : "8989",
+ "weight" : 0
+ }
+ ]
+ }
+]
\ No newline at end of file diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initSwaggerJson/api-doc1.json b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initSwaggerJson/api-doc1.json new file mode 100644 index 0000000..7c63d7e --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initSwaggerJson/api-doc1.json @@ -0,0 +1 @@ +{"swagger":"2.0","info":{"version":"1.0.0","title":"Local API Test"},"basePath":"/service","tags":[{"name":"ApiRoute"}],"paths":{"/apiRoute":{"get":{"tags":["ApiRoute"],"summary":"get all ApiRoute ","description":"","operationId":"getApiRoutes","produces":["application/json"],"parameters":[],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"$ref":"#/definitions/ApiRouteInfo"}}}}},"post":{"tags":["ApiRoute"],"summary":"add one ApiRoute ","description":"","operationId":"addApiRoute","produces":["application/json"],"parameters":[{"in":"body","name":"body","description":"ApiRoute Instance Info","required":true,"schema":{"$ref":"#/definitions/ApiRouteInfo"}}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteInfo"}},"500":{"description":"add ApiRoute error "}}}},"/apiRoute/type/{type}/{routeName}/version/{version}":{"get":{"tags":["ApiRoute"],"summary":"get one ApiRoute ","description":"","operationId":"getApiRoute","produces":["application/json"],"parameters":[{"name":"type","in":"path","description":"Route type","required":true,"type":"string","enum":["iui","api"]},{"name":"routeName","in":"path","description":"ApiRoute routeName","required":true,"type":"string"},{"name":"version","in":"path","description":"ApiRoute version","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteInfo"}},"500":{"description":"get ApiRoute error "}}},"delete":{"tags":["ApiRoute"],"summary":"delete one ApiRoute by routeName and version","description":"","operationId":"deleteApiRoute","produces":["application/json"],"parameters":[{"name":"type","in":"path","description":"Route type","required":true,"type":"string","enum":["iui","api"]},{"name":"routeName","in":"path","description":"ApiRoute routeName","required":true,"type":"string"},{"name":"version","in":"path","description":"ApiRoute version","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteResult"}},"500":{"description":"delete ApiRoute error "}}}},"/apiRoute/{routeName}/version/{version}":{"put":{"tags":["ApiRoute"],"summary":"update one ApiRoute by routeName and version","description":"","operationId":"updateApiRoute","produces":["application/json"],"parameters":[{"name":"routeName","in":"path","description":"ApiRoute routeName","required":true,"type":"string"},{"name":"version","in":"path","description":"ApiRoute version","required":true,"type":"string"},{"in":"body","name":"body","description":"ApiRoute Instance Info","required":true,"schema":{"$ref":"#/definitions/ApiRouteInfo"}}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteResult"}},"500":{"description":"update ApiRoute error "}}}}},"definitions":{"ApiRouteLifeCycle":{"type":"object","properties":{"installPath":{"type":"string"},"startScript":{"type":"string"},"stopScript":{"type":"string"}}},"ApiRouteServer":{"type":"object","properties":{"ip":{"type":"string"},"weight":{"type":"integer","format":"int32"}}},"ApiRouteResult":{"type":"object","properties":{"result":{"type":"string"},"info":{"type":"string"}}},"ApiRouteInfo":{"type":"object","properties":{"routeName":{"type":"string"},"version":{"type":"string"},"url":{"type":"string"},"apiJson":{"type":"string"},"type":{"type":"string"},"servers":{"type":"array","items":{"$ref":"#/definitions/ApiRouteServer"}},"lifeCycle":{"$ref":"#/definitions/ApiRouteLifeCycle"}}}}}
\ No newline at end of file diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initSwaggerJson/api-doc2.json b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initSwaggerJson/api-doc2.json new file mode 100644 index 0000000..eb7c8cd --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initSwaggerJson/api-doc2.json @@ -0,0 +1 @@ +{"swagger":"2.0","info":{"version":"1.0.0","title":"Local API Test2"},"basePath":"/service","tags":[{"name":"ApiRoute"}],"paths":{"/apiRoute":{"get":{"tags":["ApiRoute"],"summary":"get all ApiRoute ","description":"","operationId":"getApiRoutes","produces":["application/json"],"parameters":[],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"$ref":"#/definitions/ApiRouteInfo"}}}}},"post":{"tags":["ApiRoute"],"summary":"add one ApiRoute ","description":"","operationId":"addApiRoute","produces":["application/json"],"parameters":[{"in":"body","name":"body","description":"ApiRoute Instance Info","required":true,"schema":{"$ref":"#/definitions/ApiRouteInfo"}}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteInfo"}},"500":{"description":"add ApiRoute error "}}}},"/apiRoute/type/{type}/{routeName}/version/{version}":{"get":{"tags":["ApiRoute"],"summary":"get one ApiRoute ","description":"","operationId":"getApiRoute","produces":["application/json"],"parameters":[{"name":"type","in":"path","description":"Route type","required":true,"type":"string","enum":["iui","api"]},{"name":"routeName","in":"path","description":"ApiRoute routeName","required":true,"type":"string"},{"name":"version","in":"path","description":"ApiRoute version","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteInfo"}},"500":{"description":"get ApiRoute error "}}},"delete":{"tags":["ApiRoute"],"summary":"delete one ApiRoute by routeName and version","description":"","operationId":"deleteApiRoute","produces":["application/json"],"parameters":[{"name":"type","in":"path","description":"Route type","required":true,"type":"string","enum":["iui","api"]},{"name":"routeName","in":"path","description":"ApiRoute routeName","required":true,"type":"string"},{"name":"version","in":"path","description":"ApiRoute version","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteResult"}},"500":{"description":"delete ApiRoute error "}}}},"/apiRoute/{routeName}/version/{version}":{"put":{"tags":["ApiRoute"],"summary":"update one ApiRoute by routeName and version","description":"","operationId":"updateApiRoute","produces":["application/json"],"parameters":[{"name":"routeName","in":"path","description":"ApiRoute routeName","required":true,"type":"string"},{"name":"version","in":"path","description":"ApiRoute version","required":true,"type":"string"},{"in":"body","name":"body","description":"ApiRoute Instance Info","required":true,"schema":{"$ref":"#/definitions/ApiRouteInfo"}}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteResult"}},"500":{"description":"update ApiRoute error "}}}}},"definitions":{"ApiRouteLifeCycle":{"type":"object","properties":{"installPath":{"type":"string"},"startScript":{"type":"string"},"stopScript":{"type":"string"}}},"ApiRouteServer":{"type":"object","properties":{"ip":{"type":"string"},"weight":{"type":"integer","format":"int32"}}},"ApiRouteResult":{"type":"object","properties":{"result":{"type":"string"},"info":{"type":"string"}}},"ApiRouteInfo":{"type":"object","properties":{"routeName":{"type":"string"},"version":{"type":"string"},"url":{"type":"string"},"apiJson":{"type":"string"},"type":{"type":"string"},"servers":{"type":"array","items":{"$ref":"#/definitions/ApiRouteServer"}},"lifeCycle":{"$ref":"#/definitions/ApiRouteLifeCycle"}}}}}
\ No newline at end of file diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initUrlRootPath/initUrlRootPath.json b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initUrlRootPath/initUrlRootPath.json new file mode 100644 index 0000000..9668592 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initUrlRootPath/initUrlRootPath.json @@ -0,0 +1,4 @@ +{
+ "iuiRootPath" : "iui",
+ "apiRootPath" : "api"
+}
diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initVisualRange/initVisualRangeMatches.json b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initVisualRange/initVisualRangeMatches.json new file mode 100644 index 0000000..82ff10d --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initVisualRange/initVisualRangeMatches.json @@ -0,0 +1,3 @@ +{
+ "visualRange" : "0,1"
+}
diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initVisualRange/readme.txt b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initVisualRange/readme.txt new file mode 100644 index 0000000..2fe9f72 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/ext/initVisualRange/readme.txt @@ -0,0 +1,14 @@ +########################## initialize default visualRange Matches from msdiscover to redis ##########################
+
+
+visualRange:·þÎñµÄ¿É¼û·¶Î§ ϵͳ¼ä:0 ϵͳÄÚ:1
+
+#when msb is starting, it will automatically read this json file named "initVisualRangeMatches.json"
+
+#when msdiscover will sysn datas to apiGateway,only visualRange Matches will be save to redis.
+
+
+
+# JSON File content must be format array like below examples:
+
+0 or 1 or 0,1
\ No newline at end of file diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/find_kill_process.bat b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/find_kill_process.bat new file mode 100644 index 0000000..1b3b76b --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/find_kill_process.bat @@ -0,0 +1,23 @@ +@REM
+@REM Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE)
+@REM
+@REM Licensed under the Apache License, Version 2.0 (the "License");
+@REM you may not use this file except in compliance with the License.
+@REM You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing, software
+@REM distributed under the License is distributed on an "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@REM See the License for the specific language governing permissions and
+@REM limitations under the License.
+@REM
+echo %1 | findstr %2 | findstr %3>NUL
+echo ERRORLEVEL=%ERRORLEVEL%
+IF ERRORLEVEL 1 goto findend
+for /f "tokens=1" %%a in (%1) do (
+ echo kill %1
+ taskkill /F /pid %%a
+)
+:findend
\ No newline at end of file diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/run.bat b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/run.bat new file mode 100644 index 0000000..6e2362a --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/run.bat @@ -0,0 +1,55 @@ +@REM +@REM Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE) +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM +@echo off +title apiroute-service + +set RUNHOME=%~dp0 +echo ### RUNHOME: %RUNHOME% + +echo ### Starting apiroute-service +rem cd /d %RUNHOME% + +rem set JAVA_HOME=D:\JDK1.7\jdk\jdk\windows +set JAVA="%JAVA_HOME%\bin\java.exe" +set port=8777 + +setlocal enabledelayedexpansion +set index=1 +FOR /F "tokens=3 delims= " %%a in ('"%JAVA% -version 2>&1"')do ( + if !index! equ 1 set JAVA_VERSION=%%a + set /a index=index+1 +) +set JAVA_VERSION=%JAVA_VERSION:~1,3% +if "%JAVA_VERSION%"=="1.8" ( + set jvm_opts=-Xms16m -Xmx128m -XX:+UseSerialGC -XX:MaxMetaspaceSize=64m -XX:NewRatio=2 +) else ( + set jvm_opts=-Xms16m -Xmx128m -XX:+UseSerialGC -XX:MaxPermSize=64m -XX:NewRatio=2 +) + +set jvm_opts=%jvm_opts% -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=%port%,server=y,suspend=n +set class_path=%RUNHOME%;%RUNHOME%apiroute-service.jar +echo ### jvm_opts: %jvm_opts% +echo ### class_path: %class_path% + +%JAVA% -classpath %class_path% %jvm_opts% org.openo.msb.ApiRouteApp server %RUNHOME%conf/apiroute.yml + +IF ERRORLEVEL 1 goto showerror +exit +:showerror +echo WARNING: Error occurred during startup or Server abnormally stopped by way of killing the process,Please check! +echo After checking, press any key to close +pause +exit
\ No newline at end of file diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/run.sh b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/run.sh new file mode 100644 index 0000000..bd62668 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/run.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#JAVA_HOME="/home/conductortest/jdk1.7/jdk/linux" + +DIRNAME=`dirname $0` +RUNHOME=`cd $DIRNAME/; pwd` +echo @RUNHOME@ $RUNHOME + +#JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::") +echo @JAVA_HOME@ $JAVA_HOME +JAVA="$JAVA_HOME/bin/java" +echo @JAVA@ $JAVA +JAVA_VERSION=`$JAVA -version 2>&1 |awk 'NR==1{ sub(/"/,""); print substr($3,1,3)}'` +echo @JAVA_VERSION@ $JAVA_VERSION +if [ $JAVA_VERSION = "1.8" ] +then + JAVA_OPTS="-Xms16m -Xmx128m -XX:+UseSerialGC -XX:MaxMetaspaceSize=64m -XX:NewRatio=2" +else + JAVA_OPTS="-Xms16m -Xmx128m -XX:+UseSerialGC -XX:MaxPermSize=64m -XX:NewRatio=2" +fi +port=8779 +#JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=$port,server=y,suspend=n" +echo @JAVA_OPTS@ $JAVA_OPTS + +class_path="$RUNHOME/:$RUNHOME/apiroute-service.jar" +echo @class_path@ $class_path + +"$JAVA" $JAVA_OPTS -classpath "$class_path" org.openo.msb.ApiRouteApp server "$RUNHOME/conf/apiroute.yml" diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/stop.bat b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/stop.bat new file mode 100644 index 0000000..96e96a8 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/stop.bat @@ -0,0 +1,34 @@ +@REM +@REM Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE) +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM +@echo off +title stopping apiroute-service + +set HOME=%~dp0 +set APIROUTE_Main_Class="org.openo.msb.ApiRouteApp" + +echo ================== apiroute info ============================================= +echo HOME=$HOME +echo APIROUTE_Main_Class=%APIROUTE_Main_Class% +echo =============================================================================== + +echo ### Stopping apiroute-service +cd /d %HOME% + +rem set JAVA_HOME=D:\WorkSoftware\jdk1.7.0_60 +for /f "delims=" %%i in ('%JAVA_HOME%\bin\jcmd') do ( + call find_kill_process "%%i" %APIROUTE_Main_Class% %HOME% +) +exit
\ No newline at end of file diff --git a/apiroute/apiroute-standalone/src/assembly/resource/apiroute/stop.sh b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/stop.sh new file mode 100644 index 0000000..6d48003 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resource/apiroute/stop.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +DIRNAME=`dirname $0` +HOME=`cd $DIRNAME/; pwd` +APIROUTE_Main_Class="org.openo.msb.ApiRouteApp" + +echo ================== apiroute info ============================================= +echo HOME=$HOME +echo APIROUTE_Main_Class=$APIROUTE_Main_Class +echo =============================================================================== +cd $HOME; pwd + +echo @WORK_DIR@ $HOME + +function save_apiroute_pid(){ + apiroute_id=`ps -ef | grep $APIROUTE_Main_Class | grep $HOME | grep -v grep | awk '{print $2}'` + echo $apiroute_id +} + +function kill_apiroute_process(){ + ps -p $apiroute_id + if [ $? == 0 ]; then + kill -9 $apiroute_id + fi +} + +save_apiroute_pid; +echo @C_CMD@ kill -9 $apiroute_id +kill_apiroute_process;
\ No newline at end of file |