apache/rc.apache

changeset 684
f805be991d7f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/apache/rc.apache	Mon Sep 17 19:01:16 2012 +0200
     1.3 @@ -0,0 +1,101 @@
     1.4 +#!@l_prefix@/bin/openpkg rc
     1.5 +##
     1.6 +##  rc.apache -- Run-Commands
     1.7 +##
     1.8 +
     1.9 +%config
    1.10 +    apache_enable="$openpkg_rc_def"
    1.11 +    apache_flags=""
    1.12 +    apache_log_files="@l_prefix@/var/apache/log/access.log"
    1.13 +    apache_log_rotsteps="10"
    1.14 +    apache_log_rotminsize="10M"
    1.15 +    apache_log_rotcomplevel="9"
    1.16 +    apache_log_rotprolog="true"
    1.17 +    apache_log_rotepilog="true"
    1.18 +    apache_err_files="@l_prefix@/var/apache/log/error.log"
    1.19 +    apache_err_rotsteps="10"
    1.20 +    apache_err_rotminsize="1M"
    1.21 +    apache_err_rotcomplevel="9"
    1.22 +    apache_err_rotprolog="true"
    1.23 +    apache_err_rotepilog="true"
    1.24 +    apache_cgi_files="@l_prefix@/var/apache/log/script.log"
    1.25 +    apache_cgi_rotsteps="10"
    1.26 +    apache_cgi_rotminsize="1M"
    1.27 +    apache_cgi_rotcomplevel="9"
    1.28 +    apache_cgi_rotprolog="true"
    1.29 +    apache_cgi_rotepilog="true"
    1.30 +    apache_cachesize="10M"
    1.31 +
    1.32 +%common
    1.33 +    apache_pidfile="@l_prefix@/var/apache/run/apache.pid"
    1.34 +    apache_cachedir="@l_prefix@/var/apache/run/apache.cache"
    1.35 +    apache_signal () {
    1.36 +        [ -f $apache_pidfile ] && kill -$1 `cat $apache_pidfile`
    1.37 +    }
    1.38 +
    1.39 +%status -u @l_susr@ -o
    1.40 +    apache_usable="no"
    1.41 +    apache_active="no"
    1.42 +    @l_prefix@/sbin/apache -t 2>/dev/null && apache_usable="yes"
    1.43 +    rcService apache enable yes && \
    1.44 +        apache_signal 0 && apache_active="yes"
    1.45 +    echo "apache_enable=\"$apache_enable\""
    1.46 +    echo "apache_usable=\"$apache_usable\""
    1.47 +    echo "apache_active=\"$apache_active\""
    1.48 +
    1.49 +%start -u @l_susr@
    1.50 +    rcService apache enable yes || exit 0
    1.51 +    rcService apache active yes && exit 0
    1.52 +    ( cd @l_prefix@/var/apache/run
    1.53 +      [ -e @l_prefix@/etc/apache/apache.sh ] &&
    1.54 +          . @l_prefix@/etc/apache/apache.sh
    1.55 +      @l_prefix@/sbin/apache ${apache_flags}
    1.56 +    ) || exit $?
    1.57 +
    1.58 +%stop -u @l_susr@
    1.59 +    rcService apache enable yes || exit 0
    1.60 +    rcService apache active no  && exit 0
    1.61 +    @l_prefix@/sbin/apache -k stop
    1.62 +    sleep 2
    1.63 +
    1.64 +%restart -u @l_susr@
    1.65 +    rcService apache enable yes || exit 0
    1.66 +    rcService apache active no  && exit 0
    1.67 +    rc apache stop start
    1.68 +
    1.69 +%reload -u @l_susr@
    1.70 +    rcService apache enable yes || exit 0
    1.71 +    rcService apache active no  && exit 0
    1.72 +    @l_prefix@/sbin/apache -k graceful
    1.73 +
    1.74 +%daily -u @l_susr@
    1.75 +    rcService apache enable yes || exit 0
    1.76 +    rcTmp -i
    1.77 +    hintfile=`rcTmp -f -n hint`
    1.78 +    shtool rotate -f \
    1.79 +        -n ${apache_log_rotsteps} -s ${apache_log_rotminsize} -d \
    1.80 +        -z ${apache_log_rotcomplevel} -o @l_susr@ -g @l_mgrp@ -m 644 \
    1.81 +        -P "$apache_log_rotprolog" \
    1.82 +        -E "$apache_log_rotepilog; echo 1 >$hintfile" \
    1.83 +        ${apache_log_files}
    1.84 +    shtool rotate -f \
    1.85 +        -n ${apache_err_rotsteps} -s ${apache_err_rotminsize} -d \
    1.86 +        -z ${apache_err_rotcomplevel} -o @l_susr@ -g @l_mgrp@ -m 644 \
    1.87 +        -P "$apache_err_rotprolog" \
    1.88 +        -E "$apache_err_rotepilog; echo 1 >$hintfile" \
    1.89 +        ${apache_err_files}
    1.90 +    shtool rotate -f \
    1.91 +        -n ${apache_cgi_rotsteps} -s ${apache_cgi_rotminsize} -d \
    1.92 +        -z ${apache_cgi_rotcomplevel} -o @l_susr@ -g @l_mgrp@ -m 644 \
    1.93 +        -P "$apache_cgi_rotprolog" \
    1.94 +        -E "$apache_cgi_rotepilog; echo 1 >$hintfile" \
    1.95 +        ${apache_cgi_files}
    1.96 +    if [ ".@with_mod_filecache@" = .yes ]; then
    1.97 +        @l_prefix@/sbin/htcacheclean \
    1.98 +            -n -t -l "$apache_cachesize" -p "$apache_cachedir"
    1.99 +    fi
   1.100 +    if [ -s $hintfile ]; then
   1.101 +        @l_prefix@/sbin/apache -k graceful
   1.102 +    fi
   1.103 +    rcTmp -k
   1.104 +

mercurial