You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-proxy/polipo/files/polipo.crond-2

23 lines
640 B

#!/bin/bash
# Loop through all init.d instances
for f in /etc/init.d/polipo*; do
# only proceed if daemon is running
"${f}" --quiet status || continue
myname="${f#/etc/init.d/polipo}"
conffile="/etc/polipo/config${myname}"
pidfile="/var/run/polipo${myname}.pid"
# check if disk cache is enabled
polipo -v -c "${CONFFILE}" |
awk '$1 ~ /diskCacheRoot/ { if ($3 == "(none)") exit 1}' ||
continue
# Expire old cached objects
kill -USR1 $(cat "${pidfile}")
sleep 1
nice -n 15 su -s "/bin/sh" -c "polipo -c ${conffile} -x" polipo > /dev/null
kill -USR2 $(cat "${pidfile}")
done