You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

122 lines
4.3 KiB

#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
##
## rc.tomcat -- Run-Commands
##
%config
tomcat_enable="$openpkg_rc_def"
tomcat_home="@l_prefix@/libexec/tomcat"
tomcat_examples_file="@l_prefix@/var/tomcat/log/examples.log"
tomcat_examples_prolog="true"
tomcat_examples_epilog="true"
tomcat_examples_numfiles="10"
tomcat_examples_minsize="1M"
tomcat_examples_complevel="9"
tomcat_jasper_file="@l_prefix@/var/tomcat/log/jasper.log"
tomcat_jasper_prolog="true"
tomcat_jasper_epilog="true"
tomcat_jasper_numfiles="10"
tomcat_jasper_minsize="1M"
tomcat_jasper_complevel="9"
tomcat_servlet_file="@l_prefix@/var/tomcat/log/servlet.log"
tomcat_servlet_prolog="true"
tomcat_servlet_epilog="true"
tomcat_servlet_numfiles="10"
tomcat_servlet_minsize="1M"
tomcat_servlet_complevel="9"
tomcat_servexample_file="@l_prefix@/var/tomcat/log/servlet_examples.log"
tomcat_servexample_prolog="true"
tomcat_servexample_epilog="true"
tomcat_servexample_numfiles="10"
tomcat_servexample_minsize="1M"
tomcat_servexample_complevel="9"
tomcat_tomcat_file="@l_prefix@/var/tomcat/log/tomcat.log"
tomcat_tomcat_prolog="true"
tomcat_tomcat_epilog="true"
tomcat_tomcat_numfiles="10"
tomcat_tomcat_minsize="1M"
tomcat_tomcat_complevel="9"
%common
tomcat_pidfile="@l_prefix@/var/tomcat/log/tomcat.pid"
tomcat_signal () {
[ -f $tomcat_pidfile ] && kill -$1 `cat $tomcat_pidfile`
}
%status -u @l_susr@ -o
tomcat_usable="unknown"
tomcat_active="no"
rcService tomcat enable yes && \
tomcat_signal 0 && tomcat_active="yes"
echo "tomcat_enable=\"$tomcat_enable\""
echo "tomcat_usable=\"$tomcat_usable\""
echo "tomcat_active=\"$tomcat_active\""
%start -u @l_susr@
rcService tomcat enable yes || exit 0
rcService tomcat active yes && exit 0
JAVA_HOME="$JDK_home"; export JAVA_HOME
TOMCAT_HOME="$tomcat_home"; export TOMCAT_HOME
$TOMCAT_HOME/bin/tomcat.sh start
%stop -u @l_susr@
rcService tomcat enable yes || exit 0
rcService tomcat active no && exit 0
JAVA_HOME="$JDK_home"; export JAVA_HOME
TOMCAT_HOME="$tomcat_home"; export TOMCAT_HOME
$TOMCAT_HOME/bin/tomcat.sh stop
%restart -u @l_susr@
rcService tomcat enable yes || exit 0
rcService tomcat active no && exit 0
JAVA_HOME="$JDK_home"; export JAVA_HOME
TOMCAT_HOME="$tomcat_home"; export TOMCAT_HOME
$TOMCAT_HOME/bin/tomcat.sh stop
$TOMCAT_HOME/bin/tomcat.sh start
%daily -u @l_susr@
rcService tomcat enable yes || exit 0
# rotate logfiles
rcTmp -i
hintfile=`rcTmp -f -n hint`
shtool rotate -f \
-n ${tomcat_examples_numfiles} -s ${tomcat_examples_minsize} -d \
-z ${tomcat_examples_complevel} -o @l_susr@ -g @l_rgrp@ -m 644 \
-P "${tomcat_examples_prolog}" \
-E "${tomcat_examples_epilog} && echo 1 >$hintfile" \
${tomcat_examples_file}
shtool rotate -f \
-n ${tomcat_jasper_numfiles} -s ${tomcat_jasper_minsize} -d \
-z ${tomcat_jasper_complevel} -o @l_susr@ -g @l_rgrp@ -m 644 \
-P "${tomcat_jasper_prolog}" \
-E "${tomcat_jasper_epilog} && echo 1 >$hintfile" \
${tomcat_jasper_file}
shtool rotate -f \
-n ${tomcat_servlet_numfiles} -s ${tomcat_servlet_minsize} -d \
-z ${tomcat_servlet_complevel} -o @l_susr@ -g @l_rgrp@ -m 644 \
-P "${tomcat_servlet_prolog}" \
-E "${tomcat_servlet_epilog} && echo 1 >$hintfile" \
${tomcat_servlet_file}
shtool rotate -f \
-n ${tomcat_servexample_numfiles} -s ${tomcat_servexample_minsize} -d \
-z ${tomcat_servexample_complevel} -o @l_susr@ -g @l_rgrp@ -m 644 \
-P "${tomcat_servexample_prolog}" \
-E "${tomcat_servexample_epilog} && echo 1 >$hintfile" \
${tomcat_servexample_file}
shtool rotate -f \
-n ${tomcat_tomcat_numfiles} -s ${tomcat_tomcat_minsize} -d \
-z ${tomcat_tomcat_complevel} -o @l_susr@ -g @l_rgrp@ -m 644 \
-P "${tomcat_tomcat_prolog}" \
-E "${tomcat_tomcat_epilog} && echo 1 >$hintfile" \
${tomcat_tomcat_file}
if [ -s $hintfile ]; then
rc tomcat restart
fi
rcTmp -k
%env
rcService tomcat enable yes || exit 0
TOMCAT_HOME="$tomcat_home"
export TOMCAT_HOME