summaryrefslogtreecommitdiff
path: root/files/polipo/polipo.cron
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-20 23:09:20 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-20 23:09:20 -0200
commitf252115be193d58d345b7d18228800c68a1e47aa (patch)
tree31c95ada21d54314ecb1650f2b19e8540386dd62 /files/polipo/polipo.cron
parent89d3242cc7d4607f5eb8f1df39985c3597ee428d (diff)
parenta780e84001177f10a86a7bf824589c0553f513a0 (diff)
Merge branch 'master' of ssh://labs.riseup.net/shared-tor
Conflicts: manifests/daemon.pp
Diffstat (limited to 'files/polipo/polipo.cron')
-rwxr-xr-xfiles/polipo/polipo.cron22
1 files changed, 22 insertions, 0 deletions
diff --git a/files/polipo/polipo.cron b/files/polipo/polipo.cron
new file mode 100755
index 0000000..aba88bc
--- /dev/null
+++ b/files/polipo/polipo.cron
@@ -0,0 +1,22 @@
+#!/bin/sh
+set -e
+
+FORBIDDEN_FILE=/etc/polipo/forbidden
+CONFIG_FILE=/etc/polipo/config
+
+if [ ! -x /usr/bin/polipo ]; then
+ exit 0
+fi
+
+if [ ! -f $FORBIDDEN_FILE ]; then
+ FORBIDDEN_FILE=/dev/null
+fi
+
+PIDFILE=/var/run/polipo/polipo.pid
+[ -f "$PIDFILE" ] && kill -USR1 $(cat "$PIDFILE")
+# TODO: remove redirect stderr to /dev/null after the following bug is solved:
+# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=580434
+su -c \
+ "nice polipo -x -c $CONFIG_FILE forbiddenFile=$FORBIDDEN_FILE > /dev/null" \
+ proxy &> /dev/null
+[ -f "$PIDFILE" ] && kill -USR2 $(cat "$PIDFILE")