Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Blame | Last modification | View Log | RSS feed

#!/bin/sh
### BEGIN INIT INFO
# Provides:          oidentd ident-server
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start: 
# Should-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: replacement ident daemon
# Description:       oidentd is a replacement ident daemon
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin
OIDENTD=/usr/sbin/oidentd

# See if the daemons are there
test -f ${OIDENTD} || exit 0

# oidentd configuration
OIDENT_OPTIONS=""
OIDENT_USER="nobody"
OIDENT_GROUP="nogroup"
test -f /etc/default/oidentd && . /etc/default/oidentd

. /lib/lsb/init-functions

if [ "${OIDENT_BEHIND_PROXY}" = "yes" ]; then
  # If we have a default router, then allow it to proxy auth requests to us
  if [ -x /bin/netstat ] && [ -x /usr/bin/awk ]; then
    GATEWAY=`netstat -nr | awk '/^0.0.0.0/{print $2;}'`
  elif [ -x /bin/ip ] && [ -x /usr/bin/awk ]; then
    GATEWAY=`ip route show 0.0.0.0/0 | awk '/^default via /{print $3}'`
  fi
  if [ -n "${GATEWAY}" ]; then
    OIDENT_OPTIONS="${OIDENT_OPTIONS} -P ${GATEWAY}"
  fi
fi


OPTIONS="${OIDENT_OPTIONS} -u ${OIDENT_USER} -g ${OIDENT_GROUP}"

case "$1" in
        start)
                log_daemon_msg "Starting ident daemon" "oidentd"
                start-stop-daemon --start --quiet --oknodo --exec ${OIDENTD} -- ${OPTIONS}
                log_end_msg $?
                ;;
        stop)
                log_daemon_msg "Stopping ident daemon" "oidentd"
                start-stop-daemon --stop --quiet --oknodo --exec ${OIDENTD} -- ${OPTIONS}
                log_end_msg $?
                ;;
        reload|restart|force-reload)
                log_daemon_msg "Restarting ident daemon" "oidentd"
                start-stop-daemon --stop --quiet --exec ${OIDENTD} -- ${OPTIONS}
                sleep 2
                start-stop-daemon --start --quiet --exec ${OIDENTD} -- ${OPTIONS}
                log_end_msg $?
                ;;
        status)
                status_of_proc "$OIDENTD" "oidentd" && exit 0 || exit $?
                ;;
        *)
                log_success_msg "Usage: $0 {start|stop|restart|reload|force-reload|status}"
                exit 1
                ;;
esac

exit 0