polipo_purge 396 B

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