]> gitweb.fluxo.info Git - puppet-tor.git/commitdiff
Avoiding annoying messages
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 3 May 2011 20:18:23 +0000 (17:18 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 3 May 2011 20:18:23 +0000 (17:18 -0300)
files/polipo.cron [new file with mode: 0755]
manifests/init.pp

diff --git a/files/polipo.cron b/files/polipo.cron
new file mode 100755 (executable)
index 0000000..c8d7bd0
--- /dev/null
@@ -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
+[ -f "$PIDFILE" ] && kill -USR2 $(cat "$PIDFILE")
index a6c02bb052ebaaac6e82c0dff9b1b61c3859afee..bfd17eaa99af32520fe57b922a00d89cd3c9c556 100644 (file)
@@ -33,4 +33,14 @@ class tor {
     notify  => Service["polipo"],
     require => File["/etc/polipo"],
   }
+
+  # TODO: restore file to original state after the following bug is solved:
+  # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=580434
+  file { "/etc/cron.daily/polipo":
+    ensure  => present,
+    owner   => root,
+    group   => root,
+    mode    => 0755,
+    source  => "puppet://$server/modules/tor/polipo.cron",
+  }
 }