diff --git a/cache_swap.sh b/cache_swap.sh index 5e94072..e464aa9 100644 --- a/cache_swap.sh +++ b/cache_swap.sh @@ -8,9 +8,14 @@ SQUID_CONF=${SQUID_CONF:-"/etc/squid/squid.conf"} CACHE_SWAP=`sed -e 's/#.*//g' $SQUID_CONF | \ grep cache_dir | awk '{ print $3 }'` +init_cache_dirs=0 for adir in $CACHE_SWAP; do if [ ! -d $adir/00 ]; then echo -n "init_cache_dir $adir... " - squid -N -z -F -f $SQUID_CONF >> /var/log/squid/squid.out 2>&1 + init_cache_dirs=1 fi done + +if [ $init_cache_dirs -ne 0 ]; then + squid --foreground -z -f $SQUID_CONF >> /var/log/squid/squid.out 2>&1 +fi diff --git a/squid.service b/squid.service index f49d7db..5322847 100644 --- a/squid.service +++ b/squid.service @@ -6,12 +6,12 @@ After=network.target network-online.target nss-lookup.target [Service] Type=forking LimitNOFILE=16384 +PIDFile=/var/run/squid.pid EnvironmentFile=/etc/sysconfig/squid ExecStartPre=/usr/libexec/squid/cache_swap.sh ExecStart=/usr/sbin/squid $SQUID_OPTS -f $SQUID_CONF -ExecReload=/usr/sbin/squid $SQUID_OPTS -k reconfigure -f $SQUID_CONF -ExecStop=/usr/sbin/squid -k shutdown -f $SQUID_CONF -TimeoutSec=0 +ExecReload=/bin/kill -HUP $MAINPID +KillMode=mixed [Install] WantedBy=multi-user.target diff --git a/squid.spec b/squid.spec index c375291..4b0cca5 100644 --- a/squid.spec +++ b/squid.spec @@ -2,7 +2,7 @@ Name: squid Version: 4.7 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Squid proxy caching server Epoch: 7 # See CREDITS for breakdown of non GPLv2+ code @@ -137,7 +137,6 @@ autoconf --with-openssl \ --with-pthreads \ --disable-arch-native \ - --with-pic \ --disable-security-cert-validators \ --disable-strict-error-checking \ --with-swapdir=%{_localstatedir}/spool/squid @@ -283,6 +282,9 @@ fi %changelog +* Tue May 21 2019 Lubos Uhliarik - 7:4.7-2 +- Related: #1709299 - Use upstream squid.service + * Fri May 17 2019 Luboš Uhliarik - 7:4.7-1 - new version 4.7