diff options
author | Alin Năstac <mrness@gentoo.org> | 2006-01-09 11:51:47 +0000 |
---|---|---|
committer | Alin Năstac <mrness@gentoo.org> | 2006-01-09 11:51:47 +0000 |
commit | 0850d9ed8c250ed0b991313d50dcc6e44c54f54c (patch) | |
tree | 83b4522ad48dded565f846fd7ae8b638dcdf574c /net-proxy/squid | |
parent | Version bump. (diff) | |
download | gentoo-2-0850d9ed8c250ed0b991313d50dcc6e44c54f54c.tar.gz gentoo-2-0850d9ed8c250ed0b991313d50dcc6e44c54f54c.tar.bz2 gentoo-2-0850d9ed8c250ed0b991313d50dcc6e44c54f54c.zip |
Add rotate functionality to init script (#118376).
(Portage version: 2.0.53)
Diffstat (limited to 'net-proxy/squid')
-rw-r--r-- | net-proxy/squid/ChangeLog | 9 | ||||
-rw-r--r-- | net-proxy/squid/files/squid.initd | 11 | ||||
-rw-r--r-- | net-proxy/squid/files/squid.initd-logrotate | 82 | ||||
-rw-r--r-- | net-proxy/squid/files/squid.logrotate (renamed from net-proxy/squid/files/squid-logrotate) | 0 | ||||
-rw-r--r-- | net-proxy/squid/squid-2.5.11.ebuild | 7 | ||||
-rw-r--r-- | net-proxy/squid/squid-2.5.12.ebuild | 7 |
6 files changed, 104 insertions, 12 deletions
diff --git a/net-proxy/squid/ChangeLog b/net-proxy/squid/ChangeLog index 49207f32a808..54b1d924b039 100644 --- a/net-proxy/squid/ChangeLog +++ b/net-proxy/squid/ChangeLog @@ -1,11 +1,12 @@ # ChangeLog for net-proxy/squid # Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/ChangeLog,v 1.59 2006/01/09 06:03:12 mrness Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/ChangeLog,v 1.60 2006/01/09 11:51:47 mrness Exp $ - 09 Jan 2006; Alin Nastac <mrness@gentoo.org> files/squid.pam, - -files/squid.pam-include, -squid-2.5.10-r2.ebuild, + 09 Jan 2006; Alin Nastac <mrness@gentoo.org> files/squid.initd, + files/squid.pam, -files/squid.pam-include, +files/squid.initd-logrotate, + +files/squid.logrotate, -files/squid-logrotate, -squid-2.5.10-r2.ebuild, -squid-2.5.10-r4.ebuild, squid-2.5.11.ebuild, squid-2.5.12.ebuild: - Remove old versions. + Remove old versions. Add rotate functionality to init script (#118376). 08 Jan 2006; Stuart Longland <redhatter@gentoo.org> squid-2.5.12.ebuild: Marked 2.5.12 stable on MIPS, and fixed the copyright header to keep repoman diff --git a/net-proxy/squid/files/squid.initd b/net-proxy/squid/files/squid.initd index 950f1bf9fe84..01f4b06c9677 100644 --- a/net-proxy/squid/files/squid.initd +++ b/net-proxy/squid/files/squid.initd @@ -1,9 +1,9 @@ #!/sbin/runscript # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/files/squid.initd,v 1.2 2005/12/31 10:20:17 mrness Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/files/squid.initd,v 1.3 2006/01/09 11:51:47 mrness Exp $ -opts="${opts} reload" +opts="${opts} reload rotate" depend() { need net @@ -80,3 +80,10 @@ reload() { /usr/sbin/squid -k reconfigure eend $? } + +rotate() { + service_started squid || return 1 + ebegin "Rotating logs" + /usr/sbin/squid -k rotate + eend $? +} diff --git a/net-proxy/squid/files/squid.initd-logrotate b/net-proxy/squid/files/squid.initd-logrotate new file mode 100644 index 000000000000..b43bd3dcf069 --- /dev/null +++ b/net-proxy/squid/files/squid.initd-logrotate @@ -0,0 +1,82 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/files/squid.initd-logrotate,v 1.1 2006/01/09 11:51:47 mrness Exp $ + +opts="${opts} reload" + +depend() { + need net +} + +# Try to increase the # of filedescriptors we can open. +maxfds() { + [ -n "$SQUID_MAXFD" ] || return + [ -f /proc/sys/fs/file-max ] || return 0 + [ $SQUID_MAXFD -le 8192 ] || SQUID_MAXFD=8192 + global_file_max=`cat /proc/sys/fs/file-max` + minimal_file_max=$(($SQUID_MAXFD + 4096)) + if [ "$global_file_max" -lt $minimal_file_max ] + then + echo $minimal_file_max > /proc/sys/fs/file-max + fi + ulimit -n $SQUID_MAXFD +} + +checkconfig() { + maxfds + CACHE_SWAP=`sed -e 's/#.*//g' /etc/squid/squid.conf | \ + grep cache_dir | awk '{ print $3 }'` + [ -z "$CACHE_SWAP" ] && CACHE_SWAP=/var/cache/squid + umask 027 + for x in $CACHE_SWAP ; do + if [ ! -d $x/00 ] ; then + einfo "Initializing cache directory: $x" + cd $x + /usr/sbin/squid -z -F 2>/dev/null + if [ $? -ne 0 ] ; then + eerror "Error initializing: $x" + return 1 + fi + fi + done +} + +start() { + checkconfig || return 1 + ebegin "Starting squid" + /usr/sbin/squid ${SQUID_OPTS} + eend $? && sleep 1 +} + +stop() { + ebegin "Stopping squid" + /usr/sbin/squid -k shutdown + # Now we have to wait until squid has _really_ stopped. + sleep 1 + if [ -f /var/run/squid.pid ] ; then + einfon "Waiting ." + cnt=0 + while [ -f /var/run/squid.pid ] ; do + cnt=`expr $cnt + 1` + if [ $cnt -gt 60 ] ; then + # Waited 120 seconds now. Fail. + eend 1 "Failed." + break + fi + sleep 2 + echo -n "." + done + echo -n "done." + eend 0 + else + eend 0 + fi +} + +reload() { + checkconfig || return 1 + ebegin "Reloading squid" + /usr/sbin/squid -k reconfigure + eend $? +} diff --git a/net-proxy/squid/files/squid-logrotate b/net-proxy/squid/files/squid.logrotate index 72486b016fbf..72486b016fbf 100644 --- a/net-proxy/squid/files/squid-logrotate +++ b/net-proxy/squid/files/squid.logrotate diff --git a/net-proxy/squid/squid-2.5.11.ebuild b/net-proxy/squid/squid-2.5.11.ebuild index d725d4790a09..b381adedef03 100644 --- a/net-proxy/squid/squid-2.5.11.ebuild +++ b/net-proxy/squid/squid-2.5.11.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/squid-2.5.11.ebuild,v 1.8 2006/01/09 06:03:12 mrness Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/squid-2.5.11.ebuild,v 1.9 2006/01/09 11:51:47 mrness Exp $ inherit eutils pam toolchain-funcs @@ -172,12 +172,13 @@ src_install() { dodoc helpers/basic_auth/SASL/squid_sasl_auth* newpamd "${FILESDIR}/squid.pam" squid - newinitd "${FILESDIR}/squid.initd" squid newconfd "${FILESDIR}/squid.confd" squid if use logrotate; then + newinitd "${FILESDIR}/squid.initd-logrotate" squid insinto /etc/logrotate.d - newins "${FILESDIR}/squid-logrotate" squid + newins "${FILESDIR}/squid.logrotate" squid else + newinitd "${FILESDIR}/squid.initd" squid exeinto /etc/cron.weekly newexe "${FILESDIR}/squid.cron" squid.cron fi diff --git a/net-proxy/squid/squid-2.5.12.ebuild b/net-proxy/squid/squid-2.5.12.ebuild index 431d3337b8d6..e420c06c75e1 100644 --- a/net-proxy/squid/squid-2.5.12.ebuild +++ b/net-proxy/squid/squid-2.5.12.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/squid-2.5.12.ebuild,v 1.8 2006/01/09 06:03:12 mrness Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/squid-2.5.12.ebuild,v 1.9 2006/01/09 11:51:47 mrness Exp $ inherit eutils pam toolchain-funcs flag-o-matic @@ -172,12 +172,13 @@ src_install() { dodoc helpers/basic_auth/SASL/squid_sasl_auth* newpamd "${FILESDIR}/squid.pam" squid - newinitd "${FILESDIR}/squid.initd" squid newconfd "${FILESDIR}/squid.confd" squid if use logrotate; then + newinitd "${FILESDIR}/squid.initd-logrotate" squid insinto /etc/logrotate.d - newins "${FILESDIR}/squid-logrotate" squid + newins "${FILESDIR}/squid.logrotate" squid else + newinitd "${FILESDIR}/squid.initd" squid exeinto /etc/cron.weekly newexe "${FILESDIR}/squid.cron" squid.cron fi |