bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_tomcat/1-config_tomcat.sh

Athmane Madjoudj 0a3c81
#!/bin/bash
Athmane Madjoudj 0a3c81
# Author: Athmane Madjoudj <athmanem@gmail.com>
2b3708
uname_arch=$(uname -m)
Athmane Madjoudj 0a3c81
Athmane Madjoudj 0a3c81
t_Log "$0 - Configuring Tomcat"
Athmane Madjoudj 0a3c81
a160cc
if [ "$centos_ver" = "7" ] ;then
a160cc
   TOMCAT_SRV_NAME=tomcat
a160cc
   TOMCAT_CONF_DIR=/etc/tomcat/
a160cc
elif [ "$centos_ver" = "6" ] ; then
Athmane Madjoudj 0a3c81
   TOMCAT_SRV_NAME=tomcat6
Athmane Madjoudj 0a3c81
   TOMCAT_CONF_DIR=/etc/tomcat6/
Athmane Madjoudj 0a3c81
else
Athmane Madjoudj 0a3c81
   TOMCAT_SRV_NAME=tomcat5
Athmane Madjoudj 0a3c81
   TOMCAT_CONF_DIR=/etc/tomcat5/
Athmane Madjoudj 0a3c81
fi
Athmane Madjoudj 0a3c81
a160cc
if [ "$centos_ver" = "7" ] ;then
a160cc
  sed -i 's/<\/tomcat-users>/<user username="admin" password="admin" roles="admin,manager,admin-gui,manager-gui"\/>\n<\/tomcat-users>/' $TOMCAT_CONF_DIR/tomcat-users.xml 
a160cc
else
a160cc
  sed -i 's/<\/tomcat-users>/<user username="admin" password="admin" roles="admin,manager"\/>\n<\/tomcat-users>/' $TOMCAT_CONF_DIR/tomcat-users.xml 
a160cc
fi
Athmane Madjoudj 0a3c81
Athmane Madjoudj 0a3c81
service $TOMCAT_SRV_NAME restart
Athmane Madjoudj aa8ab0
2b3708
# we need extra sec for tomcat (and even more time for armhfp)
5c5773
if [ "$uname_arch" == "armv7l" ] ; then
2b3708
  sleep_time="300"
2b3708
else
2b3708
  sleep_time="10"
2b3708
fi
2b3708
2b3708
t_Log "Sleeping $sleep_time seconds for $uname_arch"
2b3708
sleep $sleep_time