summaryrefslogtreecommitdiffstats
path: root/esr-core/distribution/standalone/src/main/assembly/bin
diff options
context:
space:
mode:
authorlizi00164331 <li.zi30@zte.com.cn>2017-08-07 11:04:17 +0800
committerlizi00164331 <li.zi30@zte.com.cn>2017-08-07 11:04:17 +0800
commitaba957d99b0d0d21c77d80efe98a3450b6635c1a (patch)
treee8a5991c966560232d6215831ffe08324f5ff6a3 /esr-core/distribution/standalone/src/main/assembly/bin
parent4bcebdf6c7a3cf81a77e1f2931db6d596923b866 (diff)
Upload the ESR server seed code.
Issue-ID: AAI-67 Change-Id: Ie21ae7baebbb2ea8a35d8b51f75b7e21bcb78671 Signed-off-by: lizi00164331 <li.zi30@zte.com.cn>
Diffstat (limited to 'esr-core/distribution/standalone/src/main/assembly/bin')
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/bin/find_kill_process.bat24
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/bin/initDB.bat34
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/bin/initDB.sh34
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/bin/run.bat41
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/bin/run.sh36
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/bin/stop.bat34
-rw-r--r--esr-core/distribution/standalone/src/main/assembly/bin/stop.sh44
7 files changed, 247 insertions, 0 deletions
diff --git a/esr-core/distribution/standalone/src/main/assembly/bin/find_kill_process.bat b/esr-core/distribution/standalone/src/main/assembly/bin/find_kill_process.bat
new file mode 100644
index 0000000..1dffb1c
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/bin/find_kill_process.bat
@@ -0,0 +1,24 @@
+@REM
+@REM Copyright 2016 ZTE Corporation.
+@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 >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/esr-core/distribution/standalone/src/main/assembly/bin/initDB.bat b/esr-core/distribution/standalone/src/main/assembly/bin/initDB.bat
new file mode 100644
index 0000000..dd86c3e
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/bin/initDB.bat
@@ -0,0 +1,34 @@
+@REM
+@REM Copyright 2016 ZTE Corporation.
+@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
+set HOME=%~dp0
+set user=%1
+set password=%2
+set port=%3
+set host=%4
+echo start init extsys db
+echo HOME=%HOME%
+set main_path=%HOME%..\
+cd /d %main_path%
+mysql -u%user% -p%password% -P%port% -h%host% < dbscripts\mysql\openo-common-extsys-createobj.sql
+set "err=%errorlevel%"
+if "%err%"=="0" (
+ echo init extsys db success
+ ) else (
+ echo failed init extsys db
+ pause
+ ) \ No newline at end of file
diff --git a/esr-core/distribution/standalone/src/main/assembly/bin/initDB.sh b/esr-core/distribution/standalone/src/main/assembly/bin/initDB.sh
new file mode 100644
index 0000000..eb2dc24
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/bin/initDB.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# Copyright 2016 ZTE Corporation.
+#
+# 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`
+user=$1
+password=$2
+port=$3
+host=$4
+echo "start init extsys db"
+main_path=$HOME/../
+mysql -u$user -p$password -P$port -h$host <$main_path/dbscripts/mysql/openo-common-extsys-createobj.sql
+sql_result=$?
+if [ $sql_result != 0 ] ; then
+ echo "failed to init extsys database!"
+ exit 1
+fi
+echo "init extsys database success!"
+exit 0
+
diff --git a/esr-core/distribution/standalone/src/main/assembly/bin/run.bat b/esr-core/distribution/standalone/src/main/assembly/bin/run.bat
new file mode 100644
index 0000000..9de9ffa
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/bin/run.bat
@@ -0,0 +1,41 @@
+@REM
+@REM Copyright 2016 ZTE Corporation.
+@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 extsys-service
+
+set RUNHOME=%~dp0
+echo ### RUNHOME: %RUNHOME%
+echo ### Starting extsys-service
+set main_path=%RUNHOME%..\
+cd /d %main_path%
+set JAVA="%JAVA_HOME%\bin\java.exe"
+set port=8312
+set jvm_opts=-Xms50m -Xmx128m
+rem set jvm_opts=%jvm_opts% -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=%port%,server=y,suspend=n
+set class_path=%main_path%;%main_path%extsys-service.jar
+echo ### jvm_opts: %jvm_opts%
+echo ### class_path: %class_path%
+
+%JAVA% -classpath %class_path% %jvm_opts% org.openo.commonservice.extsys.ExtsysApp server %main_path%conf/extsys.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/esr-core/distribution/standalone/src/main/assembly/bin/run.sh b/esr-core/distribution/standalone/src/main/assembly/bin/run.sh
new file mode 100644
index 0000000..176fc69
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/bin/run.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+#
+# Copyright 2016 ZTE Corporation.
+#
+# 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`
+RUNHOME=`cd $DIRNAME/; pwd`
+echo @RUNHOME@ $RUNHOME
+
+echo @JAVA_HOME@ $JAVA_HOME
+JAVA="$JAVA_HOME/bin/java"
+echo @JAVA@ $JAVA
+main_path=$RUNHOME/../
+cd $main_path
+JAVA_OPTS="-Xms50m -Xmx128m"
+port=8312
+#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="$main_path/:$main_path/extsys-service.jar"
+echo @class_path@ $class_path
+
+"$JAVA" $JAVA_OPTS -classpath "$class_path" org.openo.commonservice.extsys.ExtsysApp server "$main_path/conf/extsys.yml"
+
diff --git a/esr-core/distribution/standalone/src/main/assembly/bin/stop.bat b/esr-core/distribution/standalone/src/main/assembly/bin/stop.bat
new file mode 100644
index 0000000..170f240
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/bin/stop.bat
@@ -0,0 +1,34 @@
+@REM
+@REM Copyright 2016 ZTE Corporation.
+@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 extsys-service
+
+set HOME=%~dp0
+set Main_Class="org.openo.commonservice.extsys.ExtsysApp"
+
+echo ================== extsys-service info =============================================
+echo HOME=$HOME
+echo Main_Class=%Main_Class%
+echo ===============================================================================
+
+echo ### Stopping extsys-service
+cd /d %HOME%
+
+for /f "delims=" %%i in ('"%JAVA_HOME%\bin\jcmd"') do (
+ call find_kill_process "%%i" %Main_Class%
+)
+exit \ No newline at end of file
diff --git a/esr-core/distribution/standalone/src/main/assembly/bin/stop.sh b/esr-core/distribution/standalone/src/main/assembly/bin/stop.sh
new file mode 100644
index 0000000..0afe681
--- /dev/null
+++ b/esr-core/distribution/standalone/src/main/assembly/bin/stop.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+#
+# Copyright 2016 ZTE Corporation.
+#
+# 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`
+Main_Class="org.openo.commonservice.extsys.ExtsysApp"
+
+echo ================== catalog-service info =============================================
+echo HOME=$HOME
+echo Main_Class=$Main_Class
+echo ===============================================================================
+cd $HOME; pwd
+
+echo @WORK_DIR@ $HOME
+
+function save_service_pid(){
+ service_pid=`ps -ef | grep $Main_Class | grep -v grep | awk '{print $2}'`
+ echo @service_pid@ $service_pid
+}
+
+function kill_service_process(){
+ ps -p $service_pid
+ if [ $? == 0 ]; then
+ kill -9 $service_pid
+ fi
+}
+
+save_service_pid;
+echo @C_CMD@ kill -9 $service_pid
+kill_service_process;