#!@l_prefix@/bin/openpkg rc ## ## rc.tomcat -- Run-Commands ## %config tomcat_enable="$openpkg_rc_def" # -Xss: per-thread stack size # -Xmn: young generation heap size # -Xms: start/initial heap size # -Xmx: maximum heap size tomcat_flags="-server -Xss2M -Xmn256M -Xms512M -Xmx1024M" tomcat_home="@l_prefix@/libexec/tomcat" tomcat_log_prolog="true" tomcat_log_epilog="true" tomcat_log_numfiles="10" tomcat_log_minsize="1M" tomcat_log_complevel="9" %common tomcat_pidfile="@l_prefix@/var/tomcat/run/tomcat.pid" tomcat_signal () { [ -f $tomcat_pidfile ] && kill -$1 `cat $tomcat_pidfile` } %status -u @l_rusr@ -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_rusr@ rcService tomcat enable yes || exit 0 rcService tomcat active yes && exit 0 eval `JAVA_PLATFORM="sun-jdk" @l_prefix@/bin/java-toolkit -e` CATALINA_HOME="$tomcat_home"; export CATALINA_HOME CATALINA_PID="$tomcat_pidfile"; export CATALINA_PID CATALINA_OPTS="$tomcat_flags"; export CATALINA_OPTS $CATALINA_HOME/bin/startup.sh %stop -u @l_rusr@ rcService tomcat enable yes || exit 0 rcService tomcat active no && exit 0 eval `JAVA_PLATFORM="sun-jdk" @l_prefix@/bin/java-toolkit -e` CATALINA_HOME="$tomcat_home"; export CATALINA_HOME CATALINA_PID="$tomcat_pidfile"; export CATALINA_PID CATALINA_OPTS="$tomcat_flags"; export CATALINA_OPTS $CATALINA_HOME/bin/shutdown.sh -force rm -f $tomcat_pidfile 2>/dev/null || true %restart -u @l_rusr@ rcService tomcat enable yes || exit 0 rcService tomcat active no && exit 0 rc tomcat stop rc tomcat start %daily -u @l_rusr@ rcService tomcat enable yes || exit 0 shtool rotate -f \ -n ${tomcat_log_numfiles} -s ${tomcat_log_minsize} -d \ -z ${tomcat_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \ -P "${tomcat_log_prolog}" \ -E "${tomcat_log_epilog}; rc tomcat restart" \ @l_prefix@/var/tomcat/log/catalina.out