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