blob: cbf9fa7b03695d4914ba2a38a230136912d43326 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#!/bin/sh
###
# ============LICENSE_START=======================================================
# org.onap.dcaegen2.restconfcollector
# ================================================================================
# Copyright (C) 2018-2019 Huawei. All rights reserved.
# ================================================================================
# 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.
# ============LICENSE_END=========================================================
###
usage() {
echo "restConfCollector.sh <start/stop>"
}
BASEDIR=/opt/app/restconfcollector
rm -rf /opt/app/restconfcollector/logs
mkdir /opt/app/restconfcollector/logs
cd /opt/app/restconfcollector/logs
touch console.txt
cd -
restConfCollector_start() {
echo `date +"%Y%m%d.%H%M%S%3N"` - restConfCollector_start | tee -a ${BASEDIR}/logs/console.txt
collectorPid=`pidof java`
if [ ! -z "$collectorPid" ]; then
echo "WARNING: restConf Collector already running as PID $collectorPid" | tee -a ${BASEDIR}/logs/console.txt
echo "Startup Aborted!!!" | tee -a ${BASEDIR}/logs/console.txt
exit 1
fi
# run java. The classpath is the etc dir for config files, and the lib dir
# for all the jars.
cd ${BASEDIR}
echo "192.168.17.11 onap-message-router" >> /etc/hosts
nohup $JAVA -cp "etc${PATHSEP}lib/*" $JAVA_OPTS -Dhttps.protocols=TLSv1.1,TLSv1.2 $MAINCLASS $* &
if [ $? -ne 0 ]; then
echo "restConf Collector has been started!!!" | tee -a ${BASEDIR}/logs/console.txt
fi
}
# use JAVA_HOME if provided
if [ -z "$JAVA_HOME" ]; then
echo "ERROR: JAVA_HOME not setup"
echo "Startup Aborted!!"
exit 1
else
echo "$JAVA_HOME"
JAVA=$JAVA_HOME/bin/java
fi
MAINCLASS=org.onap.dcae.RestConfCollector
# determine a path separator that works for this platform
PATHSEP=":"
case "$(uname -s)" in
Darwin)
;;
Linux)
;;
CYGWIN*|MINGW32*|MSYS*)
PATHSEP=";"
;;
*)
;;
esac
restConfCollector_stop() {
echo `date +"%Y%m%d.%H%M%S%3N"` - collector_stop
collectorPid=`pidof java`
if [ ! -z "$collectorPid" ]; then
echo "Stopping PID $collectorPid"
kill -9 $collectorPid
sleep 5
if [ ! $(pidof java) ]; then
echo "restConf Collector has been stopped!!!"
else
echo "restConf Collector is being stopped!!!"
fi
else
echo "WARNING: No restConf Collector instance is currently running";
exit 1
fi
}
case $1 in
"start")
restConfCollector_start | tee -a ${BASEDIR}/logs/console.txt
;;
"stop")
restConfCollector_stop | tee -a ${BASEDIR}/logs/console.txt
;;
*)
usage
;;
esac
|