blob: 7d3a8ada06be92bf14f3471fa7c4aeacd8b10255 [file] [log] [blame]
Christopher Lott (cl778h)978dbcf2017-08-23 18:27:19 -04001#!/bin/sh
Christopher Lott (cl778h)6a4a3492017-10-10 15:54:38 -04002# Starts the Apache-Tomcat web container with the Portal, EPSDK and DMaaP BC web apps.
3# If arguments "-i ip.2.3.4" AND "-n name" are present, adds an entry to /etc/hosts;
4# this was added as a workaround for missing DNS in the CSIT environment.
talasila91d90792017-02-17 09:31:29 -05005
Christopher Lott (cl778h)6a4a3492017-10-10 15:54:38 -04006hostip=""
7hostname=""
8while [ $# -gt 0 ]; do
9 key="$1"
10 case $key in
11 -i|--ip)
12 hostip="$2"
13 shift # past argument
14 shift # past value
15 ;;
16 -n|--name)
17 hostname="$2"
18 shift # past argument
19 shift # past value
20 ;;
21 *)
22 echo "$0: ignoring argument $key"
23 shift
24 ;;
25 esac
26done
27
28# Optionally add to /etc/hosts
29if [ -z "${hostip}" -o -z "${hostname}" ]; then
30 echo "$0: Arguments for IP and name not found, continuing."
31else
32 echo "$0: Using IP-name arguments $hostip $hostname"
33 grep $hostname /etc/hosts
34 ret_code=$?
35 if [ $ret_code != 0 ]; then
36 echo "$hostip $hostname" >> /etc/hosts
37 fi
38fi
39
40BASE=/opt/apache-tomcat-8.0.37
41if [ ! -d $BASE ] ; then
42 echo "$0: $BASE not found or not a directory"
43 exit 1
44fi
45echo "$0: Starting server from $BASE"
46LOGFILE=${BASE}/logs/catalina.out
talasila91d90792017-02-17 09:31:29 -050047echo "`date`:<-------------------- Starting -------------------->" >> $LOGFILE
Christopher Lott (cl778h)6a4a3492017-10-10 15:54:38 -040048exec ${BASE}/bin/catalina.sh run 2>&1 | tee -a $LOGFILE