summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-polipo/root
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-polipo/root')
-rw-r--r--applications/luci-polipo/root/etc/uci-defaults/luci-polipo7
-rwxr-xr-xapplications/luci-polipo/root/usr/sbin/polipo_purge18
2 files changed, 25 insertions, 0 deletions
diff --git a/applications/luci-polipo/root/etc/uci-defaults/luci-polipo b/applications/luci-polipo/root/etc/uci-defaults/luci-polipo
new file mode 100644
index 0000000000..8a033f8c35
--- /dev/null
+++ b/applications/luci-polipo/root/etc/uci-defaults/luci-polipo
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+uci batch <<-EOF
+ add ucitrack polipo
+ set ucitrack.@polipo[-1].init=polipo
+ commit ucitrack
+EOF
diff --git a/applications/luci-polipo/root/usr/sbin/polipo_purge b/applications/luci-polipo/root/usr/sbin/polipo_purge
new file mode 100755
index 0000000000..ce7c88559b
--- /dev/null
+++ b/applications/luci-polipo/root/usr/sbin/polipo_purge
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+DAEMON=/usr/sbin/polipo
+PIDFILE=`uci get polipo.daemon.pidFile`
+CFGFILE=/var/etc/polipo.conf
+
+[ -e "$PIDFILE" ] && {
+ PID=`cat $PID_FILE`
+
+ # send Polipo USR1 signal to write its in-memory cache to disk
+ kill -USR1 $PID
+ sleep 2
+ # start polipo with -x flag to purge the on-disk cache
+ polipo -c $CFGFILE -x
+ # send Polipo USR2 signal to discard its in-memory cache
+ kill -USR2 $PID
+}
+