update link to upper-constraints.txt
[dmaap/datarouter.git] / datarouter-prov / src / main / resources / misc / runreports
1 #!/bin/bash
2 # ============LICENSE_START=======================================================
3 # org.onap.dmaap
4 # ================================================================================
5 # Copyright © 2018 AT&T Intellectual Property. All rights reserved.
6 # ================================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 # ============LICENSE_END=========================================================
19 #
20 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
21
22
23 umask 0022
24
25 JAVA_HOME=/opt/java/jdk/jdk180
26 JAVA_OPTS="-Xms1G -Xmx4G"
27 JAVA_CLASS=org.onap.dmaap.datarouter.reports.Report
28 TZ=GMT0
29 PATH=$JAVA_HOME/bin:/bin:/usr/bin
30 CLASSPATH=`echo /opt/app/datartr/etc /opt/app/datartr/lib/*.jar | tr ' ' ':'`
31 LOGDIR=/opt/app/datartr/logs
32 YESTERDAY=`/bin/date --date=yesterday '+%Y%m%d'`
33
34 export CLASSPATH JAVA_HOME JAVA_OPTS TZ PATH
35
36 ID=`id -n -u`
37 GRP=`id -n -g`
38 if [ "$ID" != "datartr" ]
39 then
40     echo runreports must be started as user datartr not $ID
41     exit 1
42 fi
43 if [ "$GRP" != "datartr" ]
44 then
45     echo runreports must be started as group datartr not $GRP
46     exit 1
47 fi
48 if [ "`pgrep -u mysql mysqld`" = "" ]
49 then
50     echo MariaDB is not running.  It must be started before runreports
51     exit 1
52 fi
53
54 # Volume report
55 java $JAVA_OPTS $JAVA_CLASS -t volume -o $LOGDIR/volume.csv.$YESTERDAY yesterday </dev/null >/dev/null
56
57 # Subscriber report
58 java $JAVA_OPTS $JAVA_CLASS -t subscriber -o $LOGDIR/subscriber.csv.$YESTERDAY yesterday </dev/null >/dev/null
59
60 exit 0