michael@684: #!@l_prefix@/bin/openpkg rc michael@684: ## michael@684: ## rc.apache -- Run-Commands michael@684: ## michael@684: michael@684: %config michael@684: apache_enable="$openpkg_rc_def" michael@684: apache_flags="" michael@684: apache_log_files="@l_prefix@/var/apache/log/access.log" michael@684: apache_log_rotsteps="10" michael@684: apache_log_rotminsize="10M" michael@684: apache_log_rotcomplevel="9" michael@684: apache_log_rotprolog="true" michael@684: apache_log_rotepilog="true" michael@684: apache_err_files="@l_prefix@/var/apache/log/error.log" michael@684: apache_err_rotsteps="10" michael@684: apache_err_rotminsize="1M" michael@684: apache_err_rotcomplevel="9" michael@684: apache_err_rotprolog="true" michael@684: apache_err_rotepilog="true" michael@684: apache_cgi_files="@l_prefix@/var/apache/log/script.log" michael@684: apache_cgi_rotsteps="10" michael@684: apache_cgi_rotminsize="1M" michael@684: apache_cgi_rotcomplevel="9" michael@684: apache_cgi_rotprolog="true" michael@684: apache_cgi_rotepilog="true" michael@684: apache_cachesize="10M" michael@684: michael@684: %common michael@684: apache_pidfile="@l_prefix@/var/apache/run/apache.pid" michael@684: apache_cachedir="@l_prefix@/var/apache/run/apache.cache" michael@684: apache_signal () { michael@684: [ -f $apache_pidfile ] && kill -$1 `cat $apache_pidfile` michael@684: } michael@684: michael@684: %status -u @l_susr@ -o michael@684: apache_usable="no" michael@684: apache_active="no" michael@684: @l_prefix@/sbin/apache -t 2>/dev/null && apache_usable="yes" michael@684: rcService apache enable yes && \ michael@684: apache_signal 0 && apache_active="yes" michael@684: echo "apache_enable=\"$apache_enable\"" michael@684: echo "apache_usable=\"$apache_usable\"" michael@684: echo "apache_active=\"$apache_active\"" michael@684: michael@684: %start -u @l_susr@ michael@684: rcService apache enable yes || exit 0 michael@684: rcService apache active yes && exit 0 michael@684: ( cd @l_prefix@/var/apache/run michael@684: [ -e @l_prefix@/etc/apache/apache.sh ] && michael@684: . @l_prefix@/etc/apache/apache.sh michael@684: @l_prefix@/sbin/apache ${apache_flags} michael@684: ) || exit $? michael@684: michael@684: %stop -u @l_susr@ michael@684: rcService apache enable yes || exit 0 michael@684: rcService apache active no && exit 0 michael@684: @l_prefix@/sbin/apache -k stop michael@684: sleep 2 michael@684: michael@684: %restart -u @l_susr@ michael@684: rcService apache enable yes || exit 0 michael@684: rcService apache active no && exit 0 michael@684: rc apache stop start michael@684: michael@684: %reload -u @l_susr@ michael@684: rcService apache enable yes || exit 0 michael@684: rcService apache active no && exit 0 michael@684: @l_prefix@/sbin/apache -k graceful michael@684: michael@684: %daily -u @l_susr@ michael@684: rcService apache enable yes || exit 0 michael@684: rcTmp -i michael@684: hintfile=`rcTmp -f -n hint` michael@684: shtool rotate -f \ michael@684: -n ${apache_log_rotsteps} -s ${apache_log_rotminsize} -d \ michael@684: -z ${apache_log_rotcomplevel} -o @l_susr@ -g @l_mgrp@ -m 644 \ michael@684: -P "$apache_log_rotprolog" \ michael@684: -E "$apache_log_rotepilog; echo 1 >$hintfile" \ michael@684: ${apache_log_files} michael@684: shtool rotate -f \ michael@684: -n ${apache_err_rotsteps} -s ${apache_err_rotminsize} -d \ michael@684: -z ${apache_err_rotcomplevel} -o @l_susr@ -g @l_mgrp@ -m 644 \ michael@684: -P "$apache_err_rotprolog" \ michael@684: -E "$apache_err_rotepilog; echo 1 >$hintfile" \ michael@684: ${apache_err_files} michael@684: shtool rotate -f \ michael@684: -n ${apache_cgi_rotsteps} -s ${apache_cgi_rotminsize} -d \ michael@684: -z ${apache_cgi_rotcomplevel} -o @l_susr@ -g @l_mgrp@ -m 644 \ michael@684: -P "$apache_cgi_rotprolog" \ michael@684: -E "$apache_cgi_rotepilog; echo 1 >$hintfile" \ michael@684: ${apache_cgi_files} michael@684: if [ ".@with_mod_filecache@" = .yes ]; then michael@684: @l_prefix@/sbin/htcacheclean \ michael@684: -n -t -l "$apache_cachesize" -p "$apache_cachedir" michael@684: fi michael@684: if [ -s $hintfile ]; then michael@684: @l_prefix@/sbin/apache -k graceful michael@684: fi michael@684: rcTmp -k michael@684: