#!/bin/sh # # Polipo Startup script for the Polipo caching web proxy # # chkconfig: - 90 15 # description: Polipo is a lightweight caching web proxy that was designed \ # as a personal cache. # processname: polipo ### BEGIN INIT INFO # Provides: polipo # Required-Start: $local_fs $network $named $remote_fs # Required-Stop: $local_fs $network $named $remote_fs # Short-Description: start and stop Polipo caching web proxy # Description: Polipo is a lightweight caching web proxy that was designed # as a personal cache. ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network polipo=${POLIPO-/usr/bin/polipo} prog=polipo config=${CONFIG-/etc/polipo/config} pidfile=${PIDFILE-/var/run/polipo/polipo.pid} lockfile=${LOCKFILE-/var/lock/subsys/polipo} logfile=${LOGFILE-/var/log/polipo} cachedir=${CACHEDIR-/var/cache/polipo} piddir=$(dirname $pidfile) RETVAL=0 start() { # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 1 [ -x $polipo ] || exit 1 [ `id -u` -ne 0 ] && exit 4 # check if the polipo config is present [ -f $config ] || exit 6 echo -n $"Starting $prog: " daemon --pidfile=${pidfile} --user=polipo $polipo -c $config RETVAL=$? echo [ $RETVAL = 0 ] && touch ${lockfile} return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc -p ${pidfile} -d 3 $polipo RETVAL=$? echo [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} } reload() { echo -n $"Reloading $prog: " killproc -p ${pidfile} $polipo -USR1 RETVAL=$? echo } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status -p ${pidfile} $polipo RETVAL=$? ;; restart) stop start ;; condrestart|try-restart) if status -p ${pidfile} $polipo >&/dev/null; then stop start fi ;; force-reload|reload) reload ;; *) echo $"Usage: $prog {start|stop|restart|condrestart|reload|status}" RETVAL=3 esac exit $RETVAL