Christopher Lott (cl778h) | 978dbcf | 2017-08-23 18:27:19 -0400 | [diff] [blame] | 1 | #!/bin/sh |
Christopher Lott (cl778h) | 6a4a349 | 2017-10-10 15:54:38 -0400 | [diff] [blame] | 2 | # 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. |
talasila | 91d9079 | 2017-02-17 09:31:29 -0500 | [diff] [blame] | 5 | |
Christopher Lott (cl778h) | 6a4a349 | 2017-10-10 15:54:38 -0400 | [diff] [blame] | 6 | hostip="" |
| 7 | hostname="" |
| 8 | while [ $# -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 |
| 26 | done |
| 27 | |
| 28 | # Optionally add to /etc/hosts |
| 29 | if [ -z "${hostip}" -o -z "${hostname}" ]; then |
| 30 | echo "$0: Arguments for IP and name not found, continuing." |
| 31 | else |
| 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 |
| 38 | fi |
| 39 | |
| 40 | BASE=/opt/apache-tomcat-8.0.37 |
| 41 | if [ ! -d $BASE ] ; then |
| 42 | echo "$0: $BASE not found or not a directory" |
| 43 | exit 1 |
| 44 | fi |
| 45 | echo "$0: Starting server from $BASE" |
| 46 | LOGFILE=${BASE}/logs/catalina.out |
talasila | 91d9079 | 2017-02-17 09:31:29 -0500 | [diff] [blame] | 47 | echo "`date`:<-------------------- Starting -------------------->" >> $LOGFILE |
Christopher Lott (cl778h) | 6a4a349 | 2017-10-10 15:54:38 -0400 | [diff] [blame] | 48 | exec ${BASE}/bin/catalina.sh run 2>&1 | tee -a $LOGFILE |