File: openbsd-inetd.init

package info (click to toggle)
openbsd-inetd 0.20040915-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 188 kB
  • ctags: 156
  • sloc: ansic: 1,936; sh: 107; makefile: 37
file content (76 lines) | stat: -rw-r--r-- 1,939 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh -e
#
# start/stop the inetd super server.

DAEMON=/usr/sbin/inetd

[ -x $DAEMON -a -e /etc/inetd.conf ] || exit 0

[ -e /etc/default/openbsd-inetd ] && . /etc/default/openbsd-inetd

checkportmap () {
  if ! grep -v -s "^ *#" /etc/inetd.conf | grep -q -s 'rpc/'; then
    return 0
  fi

  if [ ! -x /usr/bin/rpcinfo ]; then
    echo
    echo "WARNING: rpcinfo not available - RPC services may be unavailable!"
    echo "         (Commenting out the rpc services in inetd.conf will"
    echo "         disable this message)"
    echo
  elif ! /usr/bin/rpcinfo -u localhost portmapper >/dev/null 2>&1; then
    echo
    echo "WARNING: portmapper inactive - RPC services unavailable!"
    echo "         (Commenting out the rpc services in inetd.conf will"
    echo "         disable this message)"
    echo
  fi
} 

checknoservices () {
    if ! grep -q "^[0-9A-Za-z/]" /etc/inetd.conf; then
	echo " no services enabled, inetd not started."
	exit 0
    fi
}

case "$1" in
    start)
        checkportmap
	echo -n "Starting internet superserver:"
	checknoservices
	start-stop-daemon --start --quiet --pidfile /var/run/inetd.pid \
	    --exec $DAEMON -- $OPTIONS
	echo " inetd."
	;;
    stop)
	echo -n "Stopping internet superserver:"
	start-stop-daemon --stop --quiet --pidfile /var/run/inetd.pid \
	    --exec $DAEMON --oknodo
	echo " inetd."
	;;
    reload|force-reload)
	echo -n "Reloading internet superserver:"
	start-stop-daemon --stop --quiet --pidfile /var/run/inetd.pid \
	    --oknodo --signal 1
	echo " inetd."
	;;
    restart)
	echo -n "Restarting internet superserver:"
	start-stop-daemon --stop --quiet --pidfile /var/run/inetd.pid \
	    --exec $DAEMON --oknodo
	checkportmap
	checknoservices
	start-stop-daemon --start --quiet --pidfile /var/run/inetd.pid \
	    --exec $DAEMON -- $OPTIONS
	echo " inetd."
	;;
    *)
	echo "Usage: /etc/init.d/inetd {start|stop|reload|force-reload|restart}"
	exit 1
	;;
esac

exit 0