apache/rc.apache

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

michael@684 1 #!@l_prefix@/bin/openpkg rc
michael@684 2 ##
michael@684 3 ## rc.apache -- Run-Commands
michael@684 4 ##
michael@684 5
michael@684 6 %config
michael@684 7 apache_enable="$openpkg_rc_def"
michael@684 8 apache_flags=""
michael@684 9 apache_log_files="@l_prefix@/var/apache/log/access.log"
michael@684 10 apache_log_rotsteps="10"
michael@684 11 apache_log_rotminsize="10M"
michael@684 12 apache_log_rotcomplevel="9"
michael@684 13 apache_log_rotprolog="true"
michael@684 14 apache_log_rotepilog="true"
michael@684 15 apache_err_files="@l_prefix@/var/apache/log/error.log"
michael@684 16 apache_err_rotsteps="10"
michael@684 17 apache_err_rotminsize="1M"
michael@684 18 apache_err_rotcomplevel="9"
michael@684 19 apache_err_rotprolog="true"
michael@684 20 apache_err_rotepilog="true"
michael@684 21 apache_cgi_files="@l_prefix@/var/apache/log/script.log"
michael@684 22 apache_cgi_rotsteps="10"
michael@684 23 apache_cgi_rotminsize="1M"
michael@684 24 apache_cgi_rotcomplevel="9"
michael@684 25 apache_cgi_rotprolog="true"
michael@684 26 apache_cgi_rotepilog="true"
michael@684 27 apache_cachesize="10M"
michael@684 28
michael@684 29 %common
michael@684 30 apache_pidfile="@l_prefix@/var/apache/run/apache.pid"
michael@684 31 apache_cachedir="@l_prefix@/var/apache/run/apache.cache"
michael@684 32 apache_signal () {
michael@684 33 [ -f $apache_pidfile ] && kill -$1 `cat $apache_pidfile`
michael@684 34 }
michael@684 35
michael@684 36 %status -u @l_susr@ -o
michael@684 37 apache_usable="no"
michael@684 38 apache_active="no"
michael@684 39 @l_prefix@/sbin/apache -t 2>/dev/null && apache_usable="yes"
michael@684 40 rcService apache enable yes && \
michael@684 41 apache_signal 0 && apache_active="yes"
michael@684 42 echo "apache_enable=\"$apache_enable\""
michael@684 43 echo "apache_usable=\"$apache_usable\""
michael@684 44 echo "apache_active=\"$apache_active\""
michael@684 45
michael@684 46 %start -u @l_susr@
michael@684 47 rcService apache enable yes || exit 0
michael@684 48 rcService apache active yes && exit 0
michael@684 49 ( cd @l_prefix@/var/apache/run
michael@684 50 [ -e @l_prefix@/etc/apache/apache.sh ] &&
michael@684 51 . @l_prefix@/etc/apache/apache.sh
michael@684 52 @l_prefix@/sbin/apache ${apache_flags}
michael@684 53 ) || exit $?
michael@684 54
michael@684 55 %stop -u @l_susr@
michael@684 56 rcService apache enable yes || exit 0
michael@684 57 rcService apache active no && exit 0
michael@684 58 @l_prefix@/sbin/apache -k stop
michael@684 59 sleep 2
michael@684 60
michael@684 61 %restart -u @l_susr@
michael@684 62 rcService apache enable yes || exit 0
michael@684 63 rcService apache active no && exit 0
michael@684 64 rc apache stop start
michael@684 65
michael@684 66 %reload -u @l_susr@
michael@684 67 rcService apache enable yes || exit 0
michael@684 68 rcService apache active no && exit 0
michael@684 69 @l_prefix@/sbin/apache -k graceful
michael@684 70
michael@684 71 %daily -u @l_susr@
michael@684 72 rcService apache enable yes || exit 0
michael@684 73 rcTmp -i
michael@684 74 hintfile=`rcTmp -f -n hint`
michael@684 75 shtool rotate -f \
michael@684 76 -n ${apache_log_rotsteps} -s ${apache_log_rotminsize} -d \
michael@684 77 -z ${apache_log_rotcomplevel} -o @l_susr@ -g @l_mgrp@ -m 644 \
michael@684 78 -P "$apache_log_rotprolog" \
michael@684 79 -E "$apache_log_rotepilog; echo 1 >$hintfile" \
michael@684 80 ${apache_log_files}
michael@684 81 shtool rotate -f \
michael@684 82 -n ${apache_err_rotsteps} -s ${apache_err_rotminsize} -d \
michael@684 83 -z ${apache_err_rotcomplevel} -o @l_susr@ -g @l_mgrp@ -m 644 \
michael@684 84 -P "$apache_err_rotprolog" \
michael@684 85 -E "$apache_err_rotepilog; echo 1 >$hintfile" \
michael@684 86 ${apache_err_files}
michael@684 87 shtool rotate -f \
michael@684 88 -n ${apache_cgi_rotsteps} -s ${apache_cgi_rotminsize} -d \
michael@684 89 -z ${apache_cgi_rotcomplevel} -o @l_susr@ -g @l_mgrp@ -m 644 \
michael@684 90 -P "$apache_cgi_rotprolog" \
michael@684 91 -E "$apache_cgi_rotepilog; echo 1 >$hintfile" \
michael@684 92 ${apache_cgi_files}
michael@684 93 if [ ".@with_mod_filecache@" = .yes ]; then
michael@684 94 @l_prefix@/sbin/htcacheclean \
michael@684 95 -n -t -l "$apache_cachesize" -p "$apache_cachedir"
michael@684 96 fi
michael@684 97 if [ -s $hintfile ]; then
michael@684 98 @l_prefix@/sbin/apache -k graceful
michael@684 99 fi
michael@684 100 rcTmp -k
michael@684 101

mercurial