Subversion Repositories

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

Rev 3 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 magnus 1
#!/bin/sh
2
### BEGIN INIT INFO
3
# Provides:          oidentd ident-server
4
# Required-Start:    $remote_fs $syslog
5
# Required-Stop:     $remote_fs $syslog
6
# Should-Start:
7
# Should-Stop:
8
# Default-Start:     2 3 4 5
9
# Default-Stop:      0 1 6
10
# Short-Description: replacement ident daemon
11
# Description:       oidentd is a replacement ident daemon
12
### END INIT INFO
13
 
14
PATH=/sbin:/bin:/usr/sbin:/usr/bin
15
OIDENTD=/usr/sbin/oidentd
16
 
17
# See if the daemons are there
18
test -f ${OIDENTD} || exit 0
19
 
20
# oidentd configuration
21
OIDENT_OPTIONS=""
22
OIDENT_USER="nobody"
23
OIDENT_GROUP="nogroup"
24
test -f /etc/default/oidentd && . /etc/default/oidentd
25
 
26
. /lib/lsb/init-functions
27
 
28
if [ "${OIDENT_BEHIND_PROXY}" = "yes" ]; then
29
  # If we have a default router, then allow it to proxy auth requests to us
30
  if [ -x /bin/netstat ] && [ -x /usr/bin/awk ]; then
31
    GATEWAY=`netstat -nr | awk '/^0.0.0.0/{print $2;}'`
32
  elif [ -x /bin/ip ] && [ -x /usr/bin/awk ]; then
33
    GATEWAY=`ip route show 0.0.0.0/0 | awk '/^default via /{print $3}'`
34
  fi
35
  if [ -n "${GATEWAY}" ]; then
36
    OIDENT_OPTIONS="${OIDENT_OPTIONS} -P ${GATEWAY}"
37
  fi
38
fi
39
 
40
 
41
OPTIONS="${OIDENT_OPTIONS} -u ${OIDENT_USER} -g ${OIDENT_GROUP}"
42
 
43
case "$1" in
44
	start)
45
		log_daemon_msg "Starting ident daemon" "oidentd"
46
		start-stop-daemon --start --quiet --oknodo --exec ${OIDENTD} -- ${OPTIONS}
47
		log_end_msg $?
48
		;;
49
	stop)
50
		log_daemon_msg "Stopping ident daemon" "oidentd"
51
		start-stop-daemon --stop --quiet --oknodo --exec ${OIDENTD} -- ${OPTIONS}
52
		log_end_msg $?
53
		;;
54
	reload|restart|force-reload)
55
		log_daemon_msg "Restarting ident daemon" "oidentd"
56
		start-stop-daemon --stop --quiet --exec ${OIDENTD} -- ${OPTIONS}
57
		sleep 2
58
		start-stop-daemon --start --quiet --exec ${OIDENTD} -- ${OPTIONS}
59
		log_end_msg $?
60
		;;
61
	status)
62
		status_of_proc "$OIDENTD" "oidentd" && exit 0 || exit $?
63
		;;
64
	*)
65
		log_success_msg "Usage: $0 {start|stop|restart|reload|force-reload|status}"
66
		exit 1
67
		;;
68
esac
69
 
70
exit 0
71