diff --git a/squid.init b/squid.init index a71e3b1..eb93293 100644 --- a/squid.init +++ b/squid.init @@ -36,16 +36,10 @@ SQUID_SHUTDOWN_TIMEOUT=${SQUID_SHUTDOWN_TIMEOUT:-100} # determine the name of the squid binary [ -f /usr/sbin/squid ] && SQUID=squid -if [ $1 -ne 'status' ]; then - [ -z "$SQUID" ] && exit 1 - - # Check that networking is up. - [ ${NETWORKING} = "no" ] && exit 1 - - # check if the squid conf file is present - [ -f /etc/squid/squid.conf ] || exit 6 -else +if [ $1 == 'status' ]; then [ -z "$SQUID" ] && exit 4 +else + [ -z "$SQUID" ] && exit 1 fi prog="$SQUID" @@ -57,12 +51,22 @@ CACHE_SWAP=`sed -e 's/#.*//g' /etc/squid/squid.conf | \ RETVAL=0 +probe() { + # Check that networking is up. + [ ${NETWORKING} = "no" ] && exit 1 + + # check if the squid conf file is present + [ -f /etc/squid/squid.conf ] || exit 6 +} + start() { + probe + for adir in $CACHE_SWAP; do - if [ ! -d $adir/00 ]; then - echo -n "init_cache_dir $adir... " - $SQUID -z -F -D >> /var/log/squid/squid.out 2>&1 - fi + if [ ! -d $adir/00 ]; then + echo -n "init_cache_dir $adir... " + $SQUID -z -F -D >> /var/log/squid/squid.out 2>&1 + fi done echo -n $"Starting $prog: " $SQUID $SQUID_OPTS >> /var/log/squid/squid.out 2>&1 @@ -129,9 +133,6 @@ rhstatus() { status $SQUID && $SQUID -k check } -probe() { - return 0 -} case "$1" in start) @@ -160,6 +161,7 @@ status) probe) probe + return 0 ;; *) diff --git a/squid.spec b/squid.spec index a14440c..1820562 100644 --- a/squid.spec +++ b/squid.spec @@ -190,8 +190,8 @@ rm -rf $RPM_BUILD_ROOT %dir %{_datadir}/squid %config(noreplace) %{_datadir}/squid/errors %config(noreplace) /etc/squid/icons -%config(noreplace) /etc/rc.d/init.d/squid -%config(noreplace) /etc/logrotate.d/squid +%attr(755,root,root) /etc/rc.d/init.d/squid +%attr(755,root,root) /etc/logrotate.d/squid %{_datadir}/squid/icons %{_sbindir}/squid %{_sbindir}/squidclient