#!/bin/sh # # Slackware init script for polipo, a small and fast caching web proxy. # # Protect polipo with credentials (format: username:password on a single line) CRED="/etc/polipo/auth/credentials" # Polipo configuration file: CFG="/etc/polipo/config" # Store the PID: PIDFILE="/var/run/polipo/polipo.pid" # Do not run as root: RUNAS="apache" start() { echo "Starting polipo..." if [ ! -r "$CFG" ]; then echo "Polipo configuration '${CFG}' not found! Exiting" exit 1 fi if [ -r "$CRED" ]; then AUTH="authCredentials=$(cat $CRED) " else AUTH=" " fi su - $RUNAS -c "polipo -c ${CFG} daemonise=true pidFile=$PIDFILE $AUTH" } stop() { echo "Stopping polipo..." kill $(cat $PIDFILE) } case "$1" in start) start ;; stop) stop ;; restart) stop sleep 1 start ;; *) echo "Usage: $0 (start|stop|restart)" esac