Subversion Repositories ALCASAR

Rev

Rev 40 | Blame | Last modification | View Log

#!/bin/sh
#
# Startup script for dansguardian
#
# chkconfig: 345 92 8
# description: A web content filtering plugin for web \
#              proxies, developed to filter using lists of \
#              banned phrases, MIME types, filename \
#              extensions and PICS labelling.
# processname: dansguardian
# pidfile: /var/run/dansguardian.pid
# config: /etc/dansguardian/dansguardian.conf

### BEGIN INIT INFO
# Provides: dansguardian
# Required-Start: $network
# Required-Stop: $network
# Should-Start: $named 
# Should-Stop: $named 
# Default-Start: 3 4 5
# Short-Description: Starts the dansguardian daemon
# Description: A web content filtering plugin for web \
#              proxies, developed to filter using lists of \
#              banned phrases, MIME types, filename \
#              extensions and PICS labelling.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

RETVAL=0

start() {
        gprintf "Starting dansguardian: "
        daemon dansguardian
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dansguardian
        return $RETVAL
}

stop() {
        gprintf "Shutting down dansguardian: "
        killproc dansguardian
        if [ ! -z "`pidof dansguardian`" ]; then
            echo
            gprintf "Giving dansguardian more time to exit: "
            while [ ! -z "`pidof dansguardian`" ]; do echo -n "."; sleep 1; done && success || failure
        fi
        echo
        RETVAL=$?
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dansguardian /var/run/dansguardian/dansguardian.pid \
        /var/lib/dansguardian/.dguardianipc /var/lib/dansguardian/.dguardianurlipc \
        /var/lib/dansguardian/.dguardianipipc
        return $RETVAL
}

restart() {
        stop
        start
}

reload() {
        gprintf "Reloading dansguardian: "
        killproc dansguardian -HUP
        RETVAL=$?
        echo
        return $RETVAL
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload)
        reload
        ;;
  condrestart)
        [ -e /var/lock/subsys/dansguardian ] && restart
        RETVAL=$?
        ;;
  status)
        status dansguardian
        RETVAL=$?
        ;;
  *)
        gprintf "Usage: %s {start|stop|restart|reload|condrestart|status}\n" "$0"
        RETVAL=1
esac

exit $RETVAL