squid/cache_swap.sh
Lubos Uhliarik f2f206eb62 Various spec file tweaks and cache_swap script optimization
Resolves: #1784383 - Add BuildRequires: systemd-rpm-macros
Resolves: #1783757 - Build with ./configure --with-pidfile=/run/squid.pid
Resolves: #1783768 - Optimize cache_swap.sh cache_dir search
2019-12-17 14:29:49 +01:00

22 lines
465 B
Bash

#!/bin/bash
if [ -f /etc/sysconfig/squid ]; then
. /etc/sysconfig/squid
fi
SQUID_CONF=${SQUID_CONF:-"/etc/squid/squid.conf"}
CACHE_SWAP=`grep '^[[:blank:]]*cache_dir' $SQUID_CONF | awk '{ print $3 }'`
init_cache_dirs=0
for adir in $CACHE_SWAP; do
if [ ! -d $adir/00 ]; then
echo -n "init_cache_dir $adir... "
init_cache_dirs=1
fi
done
if [ $init_cache_dirs -ne 0 ]; then
echo ""
squid --foreground -z -f $SQUID_CONF >> /var/log/squid/squid.out 2>&1
fi