#!/bin/sh
#stop server
echo "Start to stop tomcat......";
sh ${CATALINA_HOME}/cfg/eeducation.sh stop ;
sleep 3
sh ${CATALINA_HOME}/cfg/eeducation.sh status ;
#zip the exists files to *.war
echo "Start to zip the exist files......" ;
cd $CATALINA_HOME/webapps/ ;
jar -cf manager.war ./manager ;
echo "Start to backup *.war ......";
mkdir ~/upgrade_bak/ ;
cp -f ./manager.war ~/upgrade_bak/ ;
#delete dircetory in webapps
echo "Start to delete directorys......";
rm -rf $CATALINA_HOME/webapps/manager ;
rm -rf $CATALINA_HOME/webapps/manager.war ;
rm -rf $CATALINA_HOME/work;
#unzip *.war
echo "Start to unzip directorys......";
mkdir $CATALINA_HOME/webapps/manager ;
cd $CATALINA_HOME/webapps/manager ;
jar -xf ~/upgrade/manager.war ;
#replace special files
echo "Start to replace special files......";
cp -f ~/upgrade/config.xml $CATALINA_HOME/webapps/manager/WEB-INF/classes ;
# start server
echo "Start to start tomcat......";
sh ${CATALINA_HOME}/cfg/eeducation.sh start ;
tail -f ${CATALINA_HOME}/logs/catalina.out ;
#!/bin/sh
INST_DIR="${CATALINA_HOME}"
IREAD_USER=`whoami`
SCRIPT_NAME=`basename $0`
LOG_FILE="${CATALINA_HOME}/logs/ireadtrace.log"
SERVICE=Manager
killadapter()
{
# list pids of the iread processes
pids=`ps -fu ${IREAD_USER} | grep "java" | grep -v "grep" | awk '{print $2}'`
if [ -n "$pids" ]; then
kill -9 $pids
else
echo "iRead process does not exist!"
echo "iRead process does not exist!" >>${LOG_FILE}
fi
}
start()
{
# list pids of the iread processes
pids=`ps -fu ${IREAD_USER} | grep "java" | grep -v "grep" | awk '{print $2}'`
if [ -n "$pids" ]; then
echo "$SERVICE already running."
echo "$SERVICE already running." >>${LOG_FILE}
exit 0
fi
if [ -e ${LOG_FILE} ]; then
mv ${LOG_FILE} ${LOG_FILE}.bak
fi
echo "starting $SERVICE at: `date`.."
echo "starting $SERVICE at: `date`.." >>${LOG_FILE}
cd ${CATALINA_HOME}
bin/startup.sh 2>&1 >>${LOG_FILE} &
}
stop()
{
echo "stopping $SERVICE at: `date`"
echo "stopping $SERVICE at: `date`">>${LOG_FILE}
killadapter
}
status()
{
# list pids of the iread processes
pids=`ps -f U ${IREAD_USER} | grep "java" | grep -v "grep"`
if [ -n "$pids" ]; then
echo "$SERVICE is running"
echo "$SERVICE is running" >>${LOG_FILE}
exit 0
fi
echo $SERVICE is stopped
exit 3
}
restart()
{
stop
sleep 5
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status
;;
-h|-help|--h|--help|help)
echo "Usage: $SCRIPT_NAME {start|stop|restart|status|-h|-help|--help|help}"
exit 0
;;
*)
echo "Usage: $SCRIPT_NAME {start|stop|restart|status|-h|-help|--help|help}"
exit 1
esac
exit 0