Subversion Repositories

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

Rev 3 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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