diff options
author | Stefan Fritsch <sf@debian.org> | 2007-07-09 20:16:12 +0000 |
---|---|---|
committer | Stefan Fritsch <sf@sfritsch.de> | 2012-01-02 10:36:45 +0100 |
commit | 7706b6468787ad52ffae96aa3eeadf34e03b6f90 (patch) | |
tree | a323a0ce20fac23fa7247309cfe421c96d692dd1 /debian | |
parent | 51b74fb6cc9a80646020b022c45954ce065ad268 (diff) | |
download | apache2-7706b6468787ad52ffae96aa3eeadf34e03b6f90.tar.gz |
add htcacheclean support
git-svn-id: svn+ssh://svn.debian.org/svn/pkg-apache/trunk/apache2@420 01b336ce-410b-0410-9a02-a0e7f243c266
Diffstat (limited to 'debian')
-rw-r--r-- | debian/NEWS | 47 | ||||
-rw-r--r-- | debian/README.Debian | 16 | ||||
-rw-r--r-- | debian/apache2.2-common.apache2.cron.daily | 30 | ||||
-rw-r--r-- | debian/apache2.2-common.apache2.default | 26 | ||||
-rw-r--r-- | debian/apache2.2-common.init.d | 65 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | debian/config-dir/mods-available/disk_cache.conf | 19 | ||||
-rwxr-xr-x | debian/rules | 3 |
8 files changed, 174 insertions, 34 deletions
diff --git a/debian/NEWS b/debian/NEWS index 820969dc..b9737596 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -1,20 +1,37 @@ -apache2 (2.2.3-5) unstable; urgency=low +apache2 (2.2.4-2) unstable; urgency=low - Note to users of mod_proxy who have upgraded from Apache 2.0.x, - and to users of mod_disk_cache: + * This version introduces some changes in the configration layout and + defaults. You will probably have to adjust your configuration accordingly. - If mod_proxy was enabled at the time of the upgrade from 2.0.x to 2.2.3-4, - mod_disk_cache was enabled and disk caching switched on. This could lead to - the /var partition being filled up by the indefinitely growing disk cache. + - Module specific configuration has been moved from /etc/apache2/apache2.conf + to /etc/apache2/mods-available/*.conf for the following modules: + actions + alias + autoindex + info + mime + negotiation + setenvif + status - From version 2.2.3-5, disk caching is again switched off in the default - configuration of mod_disk_cache, as it was in 2.0.x. If you had mod_proxy - enabled during the upgrade from 2.0, you should check whether - /var/cache/apache2/mod_disk_cache contains files that you don't want to be - there. + - AddDefaultCharset is again disabled by default. See + /etc/apache2/conf.d/charset - Users of mod_disk_cache should read the comments in - /etc/apache2/mods-available/disk_cache.conf and check that their - configuration is correct. + - "Listen 443" is automatically enabled in /etc/apache2/ports.conf if + mod_ssl is enabled. - -- Stefan Fritsch <sf@debian.org> Sat, 09 Jun 2007 11:03:03 +0200 + * The NO_START functionality from /etc/default/apache2 has been removed. If + you don't want to start apache2 on boot, rename the S*apache2 start + symlinks as usual. + + * Disk caching is now enabled by default if mod_disk_cache is enabled. If + you don't want to use disk caching, check that mod_disk_cache is disabled + (it was enabled automatically by previous versions when mod_proxy was + enabled). In this case, you might also want to remove any cache files from + /var/cache/apache2/mod_disk_cache . + + To ensure that the disk cache does not grow indefinitely, htcacheclean is + now started when mod_disk_cache is enabled. The details can be configured + in /etc/default/apache2 . + + -- Stefan Fritsch <sf@debian.org> Mon, 09 Jul 2007 21:50:58 +0200 diff --git a/debian/README.Debian b/debian/README.Debian index 195b2dfa..1680df8c 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -107,11 +107,17 @@ for sites rather than modules. Using mod_disk_cache ==================== -You need to enable caching in /etc/apache2/mods-enabled/disk_cache.conf . To -prevent the disk cache to grow indefinitely, you have to use htcacheclean from -the apache2-utils package. There is currently no mechanism in the Debian -package to start htcacheclean automatically. See the htcacheclean man page for -details. +To ensure that the disk cache does not grow indefinitely, htcacheclean is +started when mod_disk_cache is enabled. Both daemon and cron (daily) mode +are supported. The configuration (run mode, cache size, ...) in +/etc/default/apache2 . + +Normally, htcacheclean is automatically started and stopped by +/etc/init.d/apache2. However, if you change the state of mod_disk_cache or the +configuration of htcacheclean while apache2 is running, you may need to +manually start/stop htcacheclean with "/etc/init.d/apache2 start-htcacheclean" +or "/etc/init.d/apache2 stop-htcacheclean". + Documentation ============= diff --git a/debian/apache2.2-common.apache2.cron.daily b/debian/apache2.2-common.apache2.cron.daily new file mode 100644 index 00000000..a84c41bf --- /dev/null +++ b/debian/apache2.2-common.apache2.cron.daily @@ -0,0 +1,30 @@ +#!/bin/sh + +# run htcacheclean + +set -e +set -u + +[ -e /usr/sbin/htcacheclean ] || exit 0 +[ -e /etc/default/apache2 ] || exit 0 + + +# edit /etc/default/apache2 to change this +HTCACHECLEAN_MODE=daemon +HTCACHECLEAN_RUN=auto +HTCACHECLEAN_SIZE=300M +HTCACHECLEAN_PATH=/var/cache/apache2/mod_disk_cache +HTCACHECLEAN_OPTIONS="" + +. /etc/default/apache2 + +[ "$HTCACHECLEAN_MODE" = "cron" ] || exit 0 + +[ "$HTCACHECLEAN_RUN" = "yes" ] || +( [ "$HTCACHECLEAN_RUN" = "auto" ] && \ + [ -e /etc/apache2/mods-enabled/disk_cache.load ] ) || exit 0 + +/usr/sbin/htcacheclean ${HTCACHECLEAN_OPTIONS} \ + -p${HTCACHECLEAN_PATH} \ + -l${HTCACHECLEAN_SIZE} + diff --git a/debian/apache2.2-common.apache2.default b/debian/apache2.2-common.apache2.default new file mode 100644 index 00000000..ffabf86b --- /dev/null +++ b/debian/apache2.2-common.apache2.default @@ -0,0 +1,26 @@ +### htcacheclean settings ### + +## run htcacheclean: yes, no, auto +## auto means run if /etc/apache2/mods-enabled/disk_cache.load exists +## default: auto +HTCACHECLEAN_RUN=auto + +## run mode: cron, daemon +## run in daemon mode or as daily cron job +## default: daemon +HTCACHECLEAN_MODE=daemon + +## cache size +HTCACHECLEAN_SIZE=300M + +## interval: if in daemon mode, clean cache every x minutes +HTCACHECLEAN_DAEMON_INTERVAL=120 + +## path to cache +## must be the same as in CacheRoot directive +HTCACHECLEAN_PATH=/var/cache/apache2/mod_disk_cache + +## additional options: +## -n : be nice +## -t : remove empty directories +HTCACHECLEAN_OPTIONS="-n" diff --git a/debian/apache2.2-common.init.d b/debian/apache2.2-common.init.d index 58cd60c7..544a7a4c 100644 --- a/debian/apache2.2-common.init.d +++ b/debian/apache2.2-common.init.d @@ -16,6 +16,14 @@ ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin" #echo "You haven't enabled any sites yet, so I'm not starting apache2." && \ #echo "To add and enable a host, use addhost and enhost." && exit 0 +#edit /etc/default/apache2 to change this. +HTCACHECLEAN_RUN=auto +HTCACHECLEAN_MODE=daemon +HTCACHECLEAN_SIZE=300M +HTCACHECLEAN_DAEMON_INTERVAL=120 +HTCACHECLEAN_PATH=/var/cache/apache2/mod_disk_cache +HTCACHECLEAN_OPTIONS="" + set -e if [ -x /usr/sbin/apache2 ] ; then HAVE_APACHE2=1 @@ -31,6 +39,28 @@ test -f /etc/default/apache2 && . /etc/default/apache2 APACHE2="$ENV /usr/sbin/apache2" APACHE2CTL="$ENV /usr/sbin/apache2ctl" +HTCACHECLEAN="$ENV /usr/sbin/htcacheclean" + +check_htcacheclean() { + [ "$HTCACHECLEAN_MODE" = "daemon" ] || return 1 + + [ "$HTCACHECLEAN_RUN" = "yes" ] && return 0 + + [ "$HTCACHECLEAN_RUN" = "auto" \ + -a -e /etc/apache2/mods-enabled/disk_cache.load ] && return 0 + + return 1 +} + +start_htcacheclean() { + $HTCACHECLEAN $HTCACHECLEAN_OPTIONS -d$HTCACHECLEAN_DAEMON_INTERVAL \ + -i -p$HTCACHECLEAN_PATH -l$HTCACHECLEAN_SIZE + +} + +stop_htcacheclean() { + killall htcacheclean 2> /dev/null || echo ...not running +} pidof_apache() { # if pidof is null for some reasons the script exits automagically @@ -98,13 +128,23 @@ case $1 in start) log_daemon_msg "Starting web server" "apache2" if $APACHE2CTL start; then + if check_htcacheclean ; then + log_progress_msg htcacheclean + start_htcacheclean || log_end_msg 1 + fi log_end_msg 0 else log_end_msg 1 fi ;; stop) - log_daemon_msg "Stopping web server" "apache2" + if check_htcacheclean ; then + log_daemon_msg "Stopping web server" "htcacheclean" + stop_htcacheclean + log_progress_msg "apache2" + else + log_daemon_msg "Stopping web server" "apache2" + fi if apache_stop; then log_end_msg 0 else @@ -127,19 +167,38 @@ case $1 in fi ;; restart) - log_daemon_msg "Restarting web server" "apache2" + if check_htcacheclean ; then + log_daemon_msg "Restarting web server" "htcacheclean" + stop_htcacheclean + log_progress_msg apache2 + else + log_daemon_msg "Restarting web server" "apache2" + fi if ! apache_stop; then log_end_msg 1 || true fi sleep 10 if $APACHE2CTL start; then + if check_htcacheclean ; then + start_htcacheclean || log_end_msg 1 + fi log_end_msg 0 else log_end_msg 1 fi ;; + start-htcacheclean) + log_daemon_msg "Starting htcacheclean" + start_htcacheclean || log_end_msg 1 + log_end_msg 0 + ;; + stop-htcacheclean) + log_daemon_msg "Stopping htcacheclean" + stop_htcacheclean + log_end_msg 0 + ;; *) - log_success_msg "Usage: /etc/init.d/apache2 {start|stop|restart|reload|force-reload}" + log_success_msg "Usage: /etc/init.d/apache2 {start|stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean}" exit 1 ;; esac diff --git a/debian/changelog b/debian/changelog index 79729286..793c256c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,8 @@ apache2 (2.2.4-2) UNRELEASED; urgency=low * Make ports.conf, conf.d/charset, and /etc/default/apache2 conffiles managed by dpkg * Listen on port 443 by default if mod_ssl is loaded (Closes: #404598) + * Add logic to start htcacheclean as daemon or cronjob. The configuration + is in /etc/default/apache2 * Add init.d dependency info from insserv overrides to /etc/init.d/apache2 * Replace apachectl with apache2ctl in docs (Closes: #164493) * Add usage message to apache2ctl (Closes: #359008) diff --git a/debian/config-dir/mods-available/disk_cache.conf b/debian/config-dir/mods-available/disk_cache.conf index e2bf240b..265429b1 100644 --- a/debian/config-dir/mods-available/disk_cache.conf +++ b/debian/config-dir/mods-available/disk_cache.conf @@ -1,16 +1,15 @@ -# a2enmod-note: needs-configuration - <IfModule mod_disk_cache.c> - CacheRoot /var/cache/apache2/mod_disk_cache +# cache cleaning is done by htcacheclean, which can be configured in +# /etc/default/apache2 +# +# For further information, see the comments in that file, +# /usr/share/doc/apache2.2-common/README.Debian, and the htcacheclean(8) +# man page. -# If you enable disk caching, you need to use htcacheclean from the -# apache2-utils package to ensure that the cache does not grow indefinitely. -# See the htcacheclean man page for details. - -# There is currently no mechanism in the Debian package to start htcacheclean -# automatically, but it is planned to add such a mechanism in the future. + # This path must be the same as the one in /etc/default/apache2 + CacheRoot /var/cache/apache2/mod_disk_cache -# CacheEnable disk / + CacheEnable disk / CacheDirLevels 5 CacheDirLength 3 diff --git a/debian/rules b/debian/rules index 7914ec34..61f49cd9 100755 --- a/debian/rules +++ b/debian/rules @@ -244,7 +244,8 @@ binary-arch: install dh_installdocs -a dh_installman -a dh_installchangelogs -a CHANGES - dh_installinit -a -r --init-script=apache2 debian/apache2.2-common.init.d -- start 91 09 + dh_installinit -a -r --name=apache2 debian/apache2.2-common.init.d -- start 91 09 + dh_installcron -a -r --name=apache2 dh_strip -a dh_link -a dh_compress -a |