23ba5719272917e25cff5acb038380ec7b13b9ab
[project/luci.git] / applications / luci-polipo / root / usr / sbin / polipo_purge
1 #!/bin/sh
2
3 DAEMON=/usr/sbin/polipo
4 PIDFILE=`uci get polipo.daemon.pidFile`
5 CFGFILE=/var/etc/polipo.conf
6
7 [ -e "$PIDFILE" ] && {
8         PID=`cat $PIDFILE`
9
10         # send Polipo USR1 signal to write its in-memory cache to disk
11         kill -USR1 $PID
12         sleep 2
13         # start polipo with -x flag to purge the on-disk cache
14         polipo -c $CFGFILE -x
15         # send Polipo USR2 signal to discard its in-memory cache
16         kill -USR2 $PID
17 }
18