File polipo-trimcache.sh of Package polipo
#!/bin/sh
CONFIG=/etc/sysconfig/polipo-trimcache
TRIMCACHE=/usr/sbin/polipo_trimcache.py
CACHEDIR=/var/cache/polipo
die() { echo "ERROR: $*" >&2; exit 1; }
[ -n "$USER" ] || die "USER environment variable not set"
[ "$USER" = "polipo" ] || die "must run as user \"polipo\" (attempt to run as \"$USER\")"
[ -e "$CONFIG" ] || die "configuration file $CONFIG does not exist"
[ -r "$CONFIG" ] || die "configuration file $CONFIG exists but is not readable"
[ -e "$TRIMCACHE" ] || die "trimcache script $TRIMCACHE does not exist"
[ -x "$TRIMCACHE" ] || die "trimcache script $TRIMCACHE exists but is not executable"
. "$CONFIG"
[ "$POLIPO_TRIMCACHE_RUN" = "yes" ] || exit 0
[ -n "$POLIPO_TRIMCACHE_SIZE" ] || die "POLIPO_TRIMCACHE_SIZE not set in $CONFIG"
CMD="/usr/bin/python $TRIMCACHE"
[ "$POLIPO_TRIMCACHE_PRECISE_EXPIRY" = "yes" ] && CMD="$CMD --precise-expiry"
[ "$POLIPO_TRIMCACHE_REPORT" = "yes" ] && CMD="$CMD --verbose"
exec $CMD "$CACHEDIR" "$POLIPO_TRIMCACHE_SIZE"