diff options
author | HuabingZhao <zhao.huabing@zte.com.cn> | 2017-07-25 15:18:33 +0800 |
---|---|---|
committer | HuabingZhao <zhao.huabing@zte.com.cn> | 2017-07-25 18:11:59 +0800 |
commit | 672f3d40be83d9e380fd7be4b674d5e8d5fa36de (patch) | |
tree | 43105e1d5e2ba8e8accea8648e57e1cf87db3f00 /apiroute/apiroute-standalone/src/assembly | |
parent | 41d3db15a8e1a0496f9c2a5e15db2998a32bb9bf (diff) |
Divide the MSB source codes into two repos
Change-Id: Ie76d545b214a8ce5191f215350a623e1529983d9
Issue-id: MSB-5
Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
Diffstat (limited to 'apiroute/apiroute-standalone/src/assembly')
16 files changed, 351 insertions, 0 deletions
diff --git a/apiroute/apiroute-standalone/src/assembly/resources/apiroute/conf/apiroute.yml b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/conf/apiroute.yml new file mode 100644 index 0000000..04c3531 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/conf/apiroute.yml @@ -0,0 +1,47 @@ +defaultWorkspace: ../apiroute-works
+
+defaultName: ${DW_DEFAULT_NAME:-Stranger}
+
+
+# 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: true
+
+
+# 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: 8066
+
+# 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: WARN
+ timeZone: UTC
+ logFormat: "%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%c][%t] - %m%n"
+ - type: file
+ threshold: INFO
+ logFormat: "%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%c][%t] - %m%n"
+ currentLogFilename: ../apiroute-works/logs/msb-apiroute.log
+ archivedLogFilenamePattern: ../apiroute-works/logs/zip/msb-apiroute-%d{yyyy-MM-dd}.log.gz
+ archivedFileCount: 7
+ timeZone: UTC
+
diff --git a/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initApiGatewayConfig/initApiGatewayConfig.json b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initApiGatewayConfig/initApiGatewayConfig.json new file mode 100644 index 0000000..67580e1 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initApiGatewayConfig/initApiGatewayConfig.json @@ -0,0 +1,3 @@ +{
+ "port" : "80"
+}
diff --git a/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteLabels/initRouteLabelsMatches.json b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteLabels/initRouteLabelsMatches.json new file mode 100644 index 0000000..44fb07e --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteLabels/initRouteLabelsMatches.json @@ -0,0 +1,7 @@ +{
+ "namespace":"all",
+ "predefineLabels":
+ {
+ "visualRange" : "0"
+ }
+}
diff --git a/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteLabels/initRouteLabelsMatches.json.sample b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteLabels/initRouteLabelsMatches.json.sample new file mode 100644 index 0000000..6743912 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteLabels/initRouteLabelsMatches.json.sample @@ -0,0 +1,12 @@ +{
+ "namespace":"all",
+ "predefineLabels":
+ {
+ "visualRange" : "0",
+ "network_plane_type":""
+ },
+ "customLabels":
+ {
+ "custom-key":"custom-value"
+ }
+}
diff --git a/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteLabels/readme.txt b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteLabels/readme.txt new file mode 100644 index 0000000..3e95c5c --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteLabels/readme.txt @@ -0,0 +1,17 @@ +Apigateway can synchronized service informations from the service discovery by configuring filter tag。
+Synchronization filter configuration file path:apiroute\ext\initRouteLabels\initVisualRangeMatches.json,
+{
+ "namespace":"",
+ "routeLabels":
+ {
+ "visualRange" : "0",
+ "network_plane_type":""
+ }
+}
+namespace为命令空间过滤条件,值为空则忽略此项过滤,否则只有服务namespace属性与条件一致的服务才进行下一步的自定义标签匹配。
+routeLabels为自定义标签,用户可自定义键值对匹配条件,支持多项值,以|分隔。任一个标签的值满足即同步
+当同步服务信息时使用visualRange这个标签筛选,取值范围 系统间:0(默认) 系统内:1,其中系统间将对服务路由访问做鉴权处理。
+
+如果是docker部署首选在apigateway所在容器配置env环境变量获取:
+变量名:NAMESPACE
+变量名:ROUTE_LABELS 变量值格式:visualRange:0; network_plane_type:xx|yy
diff --git a/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteWay/initRouteWay.json b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteWay/initRouteWay.json new file mode 100644 index 0000000..b6ebf27 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteWay/initRouteWay.json @@ -0,0 +1,3 @@ +{
+ "routeWay":"ip"
+}
\ No newline at end of file diff --git a/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteWay/readme.txt b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteWay/readme.txt new file mode 100644 index 0000000..c219550 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initRouteWay/readme.txt @@ -0,0 +1,5 @@ +Apigateway 路由方式:ip/domain; 默认为ip
+
+如果是docker部署首选在apigateway所在容器配置env环境变量获取:
+变量名:ROUTE_WAY 变量可选值:ip/domain
+
diff --git a/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initServices/msb.json b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initServices/msb.json new file mode 100644 index 0000000..c5d526a --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initServices/msb.json @@ -0,0 +1,31 @@ +[{
+ "serviceName" : "microservices",
+ "version" : "v1",
+ "url" : "/api/microservices/v1",
+ "apiJson" : "/api/microservices/v1/swagger.json",
+ "apiJsonType" : "1",
+ "metricsUrl" : "/admin/metrics",
+ "control" : "1",
+ "status" : "1",
+ "host":"msb",
+ "servers" : [{
+ "ip" : "127.0.0.1",
+ "port" : "8066",
+ "weight" : 0
+ }
+ ]
+ },
+ {
+ "serviceName" : "microservices",
+ "url" : "/iui/microservices",
+ "control" : "1",
+ "status" : "1",
+ "host":"msb",
+ "servers" : [{
+ "ip" : "127.0.0.1",
+ "port" : "8066",
+ "weight" : 0
+ }
+ ]
+ }
+]
diff --git a/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initServices/readme.txt b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initServices/readme.txt new file mode 100644 index 0000000..59ef5e4 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/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/resources/apiroute/ext/initSwaggerJson/api-doc1.json b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initSwaggerJson/api-doc1.json new file mode 100644 index 0000000..7c63d7e --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/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/resources/apiroute/ext/initSwaggerJson/api-doc2.json b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initSwaggerJson/api-doc2.json new file mode 100644 index 0000000..eb7c8cd --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/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/resources/apiroute/ext/initUrlRootPath/initUrlRootPath.json b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initUrlRootPath/initUrlRootPath.json new file mode 100644 index 0000000..9668592 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/initUrlRootPath/initUrlRootPath.json @@ -0,0 +1,4 @@ +{
+ "iuiRootPath" : "iui",
+ "apiRootPath" : "api"
+}
diff --git a/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/redisConf/redis.properties b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/redisConf/redis.properties new file mode 100644 index 0000000..939e35b --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/ext/redisConf/redis.properties @@ -0,0 +1,18 @@ +redis.host=127.0.0.1 +redis.port=6379 +#connectionTimeout +redis.connectionTimeout=2000 +#redis dbIndex锛宒efaule:0 +redis.db_index=0 + +#--------------redis pool config-------------- +#maxTotal +redis.pool.maxTotal=50 +#maxIdle +redis.pool.maxIdle=30 +#maxWaitMillis:ms +redis.pool.maxWaitMillis=5000 +#testOnBorrow +redis.pool.testOnBorrow=false +#testOnReturn +redis.pool.testOnReturn=true diff --git a/apiroute/apiroute-standalone/src/assembly/resources/apiroute/run.sh b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/run.sh new file mode 100644 index 0000000..fad6b20 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/run.sh @@ -0,0 +1,70 @@ +# +# 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. +# + + +#!/bin/sh + +DIRNAME=`dirname $0` +RUNHOME=`cd $DIRNAME/; pwd` +echo @RUNHOME@ $RUNHOME + +if [ -f "$RUNHOME/setenv.sh" ]; then + . "$RUNHOME/setenv.sh" +else +echo "can not found $RUNHOME/setenv.sh" +fi + +echo ================== ENV_INFO ============================================= +echo @RUNHOME@ $RUNHOME +echo @JAVA_HOME@ $JAVA_HOME +echo @Main_Class@ $Main_Class +echo @APP_INFO@ $APP_INFO +echo @Main_JAR@ $Main_JAR +echo @Main_Conf@ $Main_Conf +echo ========================================================================== + +echo start $APP_INFO ... + +JAVA="$JAVA_HOME/bin/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 + +JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$RUNHOME/../apiroute-works/logs/dump-msb-$(date +%Y%m%d%H%M%S).hprof" +port=8777 +#JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=$port,server=y,suspend=n" + +CLASS_PATH="$RUNHOME/:$RUNHOME/$Main_JAR" + +echo ================== RUN_INFO ============================================= +echo @JAVA_HOME@ $JAVA_HOME +echo @JAVA@ $JAVA +echo @JAVA_OPTS@ $JAVA_OPTS +echo @CLASS_PATH@ $CLASS_PATH +echo @EXT_DIRS@ $EXT_DIRS +echo ========================================================================== + +echo @JAVA@ $JAVA +echo @JAVA_CMD@ +"$JAVA" $JAVA_OPTS -classpath "$CLASS_PATH" $Main_Class server "$RUNHOME/$Main_Conf" + + diff --git a/apiroute/apiroute-standalone/src/assembly/resources/apiroute/setenv.sh b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/setenv.sh new file mode 100644 index 0000000..131b734 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/setenv.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +Main_Class="org.onap.msb.apiroute.ApiRouteApp" +Main_JAR="apiroute-service.jar" +Main_Conf="conf/apiroute.yml" +APP_INFO="msb-apiroute-service" + +if [ -f "/etc/timezone" ]; then + export TZ=`cat /etc/timezone` +fi
\ No newline at end of file diff --git a/apiroute/apiroute-standalone/src/assembly/resources/apiroute/stop.sh b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/stop.sh new file mode 100644 index 0000000..3e7d3a1 --- /dev/null +++ b/apiroute/apiroute-standalone/src/assembly/resources/apiroute/stop.sh @@ -0,0 +1,59 @@ +# +# 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. +# + +#!/bin/sh + +DIRNAME=`dirname $0` +RUNHOME=`cd $DIRNAME/; pwd` +echo @RUNHOME@ $RUNHOME + + +if [ -f "$RUNHOME/setenv.sh" ]; then + . "$RUNHOME/setenv.sh" +else +echo "can not found $RUNHOME/setenv.sh" +fi + + +echo ================== ENV_INFO ============================================= +echo RUNHOME=$RUNHOME +echo JAVA_BASE=$JAVA_BASE +echo Main_Class=$Main_Class +echo APP_INFO=$APP_INFO +echo ========================================================================== + + +cd $RUNHOME; pwd + +function save_app_pid(){ + app_id=`ps -ef | grep $Main_Class| grep $RUNHOME | grep -v grep | awk '{print $2}'` + echo @app_id@ $app_id +} + +function kill_app_process(){ + ps -p $app_id + if [ $? == 0 ]; then + kill -9 $app_id + fi +} + +save_app_pid; +echo @C_CMD@ kill -9 $app_id +kill_app_process; + + + + |