Bug 1201023 - Clean up squid.sysconfig and improve cache_swap.sh
Summary: Clean up squid.sysconfig and improve cache_swap.sh
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: squid
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Luboš Uhliarik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1195807
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-03-11 21:02 UTC by Marcos Mello
Modified: 2015-12-02 17:39 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-02 09:59:34 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Marcos Mello 2015-03-11 21:02:27 UTC
Today cache_swap.sh runs 'squid -z' as many times as squid.conf cache_dir occurrences. It can run only once if at least one directory structure is missing.

I suggest the following script, that:

- Run 'squid -z' only once.
- Check if base cache_dir directory exists.
- Does not redirect squid's output to a file. These days we have journald to nicely put everything in the normal logs (be the journal or classic syslog).
- Use Bash's features ([[, <<<).
- Replace grep/sed with just awk.
- Drop squid.sysconfig use.


cache_swap.sh
****************************
#!/bin/bash

CACHE_SWAP=$(awk '/^cache_dir/ {print $3}' < /etc/squid/squid.conf)

run=0
if [[ $CACHE_SWAP ]]; then
    while read adir; do
        if [[ -d $adir && ! -d $adir/00 ]]; then
            run=1
            break
        fi
    done <<< "$CACHE_SWAP"
fi

if [[ $run == 1 ]]; then
    squid -N -z || exit 1
fi

exit 0
****************************

squid is still called with '-N' for now (see bug 168592).

Then drop from squid.sysconfig:

SQUID_SHUTDOWN_TIMEOUT: not used. A leftover from the long gone SysV script.
SQUID_CONF: redundant AFAIU. At compile time, default configuration file path is hardcoded into squid binary. '-f /path' is only needed when we want override it. I may be missing something, but is there a usecase that justify keeping it?

It will demand changes to squid.service too, removing '-f $SQUID_CONF' there. This can be done along with (urgent) modifications needed for bug 1176318 and bug 1145235.

Comment 1 Marcos Mello 2015-03-11 21:04:36 UTC
> 
> squid is still called with '-N' for now (see bug 168592).

Sorry, wrong bug. I mean bug 1168592.

Comment 2 Marcos Mello 2015-04-03 13:36:39 UTC
Squid accepts leading spaces/tabs in squid.conf. Catch that in awk:

cache_swap.sh
****************************
#!/bin/bash

CACHE_SWAP=$(awk '/^\s*cache_dir/ {print $3}' < /etc/squid/squid.conf)

run=0
if [[ $CACHE_SWAP ]]; then
    while read adir; do
        if [[ -d $adir && ! -d $adir/00 ]]; then
            run=1
            break
        fi
    done <<< "$CACHE_SWAP"
fi

if [[ $run == 1 ]]; then
    squid -N -z || exit 1
fi

exit 0
****************************

Comment 3 Fedora Admin XMLRPC Client 2015-04-09 10:22:35 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 4 Marcos Mello 2015-06-06 12:15:26 UTC
New version that creates the SSL DB:

cache_swap.sh
****************************
#!/bin/bash

CACHE_SWAP=$(awk '/^\s*cache_dir/ {print $3}' < /etc/squid/squid.conf)

run=0
if [[ $CACHE_SWAP ]]; then
    while read adir; do
        if [[ -d $adir && ! -d $adir/00 ]]; then
            run=1
            break
        fi
    done <<< "$CACHE_SWAP"
fi

if [[ $run == 1 ]]; then
    squid -N -z || exit 1
fi

if [[ ! -d /var/lib/squid/ssl_db ]]; then
    if [[ -x /usr/lib64/squid/ssl_crtd ]]; then
        runuser -u squid -- /usr/lib64/squid/ssl_crtd -c -s /var/lib/squid/ssl_db
    else
        runuser -u squid -- /usr/lib/squid/ssl_crtd -c -s /var/lib/squid/ssl_db
    fi
fi

exit 0
****************************

See bug 1195807.

Comment 5 Fedora End Of Life 2015-11-04 15:30:52 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 6 Fedora End Of Life 2015-12-02 09:59:39 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.