[polipo] - Modified the daily purge script to read, honor the sysconfig environment file - In the daily purge

jcp jcp at fedoraproject.org
Fri Jun 29 03:42:49 UTC 2012


commit a41549c3e05b8fdcbd30e6db41ab444f1e69f9f9
Author: John C. Peterson <jcp at eskimo.com>
Date:   Thu Jun 28 18:22:40 2012 -0700

    - Modified the daily purge script to read, honor the sysconfig environment file
    - In the daily purge script, su prints "...killed." for some reason, no fix yet.

 polipo.cron |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/polipo.cron b/polipo.cron
index dfd7b16..63ef4a3 100755
--- a/polipo.cron
+++ b/polipo.cron
@@ -2,20 +2,33 @@
 #
 # flush polipo disk cache
 #
-FORBIDDEN_FILE=/etc/polipo/forbidden
 CONFIG_FILE=/etc/polipo/config
+ENVIRONMENT_FILE=/etc/sysconfig/polipo
+FORBIDDEN_FILE=/etc/polipo/forbidden
+PIDFILE=/var/run/polipo/polipo.pid
 
 if [ ! -x /usr/bin/polipo ]; then
   exit 0
 fi
 
-if [ ! -f $FORBIDDEN_FILE ]; then
+if [ -f "$ENVIRONMENT_FILE" ]; then
+  . $ENVIRONMENT_FILE
+fi
+
+if [ ! -f "$FORBIDDEN_FILE" ]; then
   FORBIDDEN_FILE=/dev/null
 fi  
 
-PIDFILE=/var/run/polipo/polipo.pid
-[ -f "$PIDFILE" ] && kill -USR1 $(cat "$PIDFILE")
-su -s /bin/sh -c \
-  "nice polipo -x -c $CONFIG_FILE forbiddenFile=$FORBIDDEN_FILE > /dev/null" \
-  polipo
-[ -f "$PIDFILE" ] && kill -USR2 $(cat "$PIDFILE")
+if [ -f "$PIDFILE" ]; then
+  # Instruct polipo to to flush its in-memory cache to disk (signal USR1)
+  kill -USR1 $(cat "$PIDFILE")
+  # Allow some time for polipo to perform the requested flush
+  sleep 2
+  # Since f17, the following su command prints "...killed." to stdout ???
+  su -s /bin/sh -c \
+    "nice polipo -x -c $CONFIG_FILE forbiddenFile=$FORBIDDEN_FILE > /dev/null" \
+    polipo
+  # Instruct polipo to to discard its in-memory cache (signal USR2)
+  kill -USR2 $(cat "$PIDFILE")
+fi
+


More information about the scm-commits mailing list