diff options
author | Alin Năstac <mrness@gentoo.org> | 2006-01-18 21:39:10 +0000 |
---|---|---|
committer | Alin Năstac <mrness@gentoo.org> | 2006-01-18 21:39:10 +0000 |
commit | 1e0eac9c0df79ed0780c62a36336c95776c866ad (patch) | |
tree | 1e58215d4276745ae70d9d03702253368278adfc /net-proxy | |
parent | Stable on ppc64; bug #118832 (diff) | |
download | gentoo-2-1e0eac9c0df79ed0780c62a36336c95776c866ad.tar.gz gentoo-2-1e0eac9c0df79ed0780c62a36336c95776c866ad.tar.bz2 gentoo-2-1e0eac9c0df79ed0780c62a36336c95776c866ad.zip |
Display squid output on failure to initialize cache directories (#119215).
(Portage version: 2.0.53)
Diffstat (limited to 'net-proxy')
-rw-r--r-- | net-proxy/squid/ChangeLog | 6 | ||||
-rw-r--r-- | net-proxy/squid/files/squid.initd | 124 | ||||
-rw-r--r-- | net-proxy/squid/files/squid.initd-logrotate | 116 |
3 files changed, 125 insertions, 121 deletions
diff --git a/net-proxy/squid/ChangeLog b/net-proxy/squid/ChangeLog index 54b1d924b039..ffc5a95b8840 100644 --- a/net-proxy/squid/ChangeLog +++ b/net-proxy/squid/ChangeLog @@ -1,6 +1,10 @@ # 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.60 2006/01/09 11:51:47 mrness Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/ChangeLog,v 1.61 2006/01/18 21:39:10 mrness Exp $ + + 18 Jan 2006; Alin Nastac <mrness@gentoo.org> files/squid.initd, + files/squid.initd-logrotate: + Display squid output on failure to initialize cache directories (#119215). 09 Jan 2006; Alin Nastac <mrness@gentoo.org> files/squid.initd, files/squid.pam, -files/squid.pam-include, +files/squid.initd-logrotate, diff --git a/net-proxy/squid/files/squid.initd b/net-proxy/squid/files/squid.initd index 01f4b06c9677..82597c89b8e9 100644 --- a/net-proxy/squid/files/squid.initd +++ b/net-proxy/squid/files/squid.initd @@ -1,89 +1,89 @@ #!/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.3 2006/01/09 11:51:47 mrness Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/files/squid.initd,v 1.4 2006/01/18 21:39:10 mrness Exp $ opts="${opts} reload rotate" depend() { - need net + 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 + [ -n "$SQUID_MAXFD" ] || return + [ -f /proc/sys/fs/file-max ] || return 0 + [ $SQUID_MAXFD -le 8192 ] || SQUID_MAXFD=8192 + local global_file_max=`cat /proc/sys/fs/file-max` + local 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 + maxfds + local CACHE_SWAP=`awk '/^[ \t]*cache_dir[ \t]+/ { printf "%s ", $3 ; }' < /etc/squid/squid.conf` + [ -z "$CACHE_SWAP" ] && CACHE_SWAP=/var/cache/squid + umask 027 + for x in $CACHE_SWAP ; do + if [ ! -d $x/00 ] ; then + ebegin "Initializing cache directories" + local INIT_CACHE_RESPONSE=`/usr/sbin/squid -z -N -D 2>&1` + if [ $? != 0 ] || [ "$INIT_CACHE_RESPONSE" != "${INIT_CACHE_RESPONSE/erminated abnormally}" ]; then + eend 1 + echo "$INIT_CACHE_RESPONSE" + return 1 + fi + eend 0 + break + fi + done + return 0 } start() { - checkconfig || return 1 - ebegin "Starting squid" - /usr/sbin/squid ${SQUID_OPTS} - eend $? && sleep 1 + 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 + 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 + eend 0 + else + eend 0 + fi } reload() { - checkconfig || return 1 - ebegin "Reloading squid" - /usr/sbin/squid -k reconfigure - eend $? + checkconfig || return 1 + ebegin "Reloading squid" + /usr/sbin/squid -k reconfigure + eend $? } rotate() { - service_started squid || return 1 - ebegin "Rotating logs" - /usr/sbin/squid -k rotate - eend $? + 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 index b43bd3dcf069..cf06aab7aa54 100644 --- a/net-proxy/squid/files/squid.initd-logrotate +++ b/net-proxy/squid/files/squid.initd-logrotate @@ -1,82 +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 $ +# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/files/squid.initd-logrotate,v 1.2 2006/01/18 21:39:10 mrness Exp $ opts="${opts} reload" depend() { - need net + 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 + [ -n "$SQUID_MAXFD" ] || return + [ -f /proc/sys/fs/file-max ] || return 0 + [ $SQUID_MAXFD -le 8192 ] || SQUID_MAXFD=8192 + local global_file_max=`cat /proc/sys/fs/file-max` + local 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 + maxfds + local CACHE_SWAP=`awk '/^[ \t]*cache_dir[ \t]+/ { printf "%s ", $3 ; }' < /etc/squid/squid.conf` + [ -z "$CACHE_SWAP" ] && CACHE_SWAP=/var/cache/squid + umask 027 + for x in $CACHE_SWAP ; do + if [ ! -d $x/00 ] ; then + ebegin "Initializing cache directories" + local INIT_CACHE_RESPONSE=`/usr/sbin/squid -z -N -D 2>&1` + if [ $? != 0 ] || [ "$INIT_CACHE_RESPONSE" != "${INIT_CACHE_RESPONSE/erminated abnormally}" ]; then + eend 1 + echo "$INIT_CACHE_RESPONSE" + return 1 + fi + eend 0 + break + fi + done + return 0 } start() { - checkconfig || return 1 - ebegin "Starting squid" - /usr/sbin/squid ${SQUID_OPTS} - eend $? && sleep 1 + 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 + 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 + eend 0 + else + eend 0 + fi } reload() { - checkconfig || return 1 - ebegin "Reloading squid" - /usr/sbin/squid -k reconfigure - eend $? + checkconfig || return 1 + ebegin "Reloading squid" + /usr/sbin/squid -k reconfigure + eend $? } |