summaryrefslogtreecommitdiff
path: root/portmap/portmap.init
blob: 3c05b8c2a3464366685584e63cfc0b41c5be327f (plain)
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
#!/bin/sh
#
# start/stop portmap daemon.

test -f /sbin/portmap || exit 0

case "$1" in
    start)
	echo -n "Starting portmap daemon:"
	echo -n " portmap"
        start-stop-daemon --start --quiet --exec /sbin/portmap
	echo "."

	if [ -f /var/run/portmap.upgrade-state ]; then
          echo -n "Restoring old RPC service information..."
          sleep 1 # needs a short pause or pmap_set won't work. :(
	  pmap_set </var/run/portmap.upgrade-state
	  rm -f /var/run/portmap.upgrade-state
          echo "done."
        fi

	;;
    stop)
        echo -n "Stopping portmap daemon:"
        echo -n " portmap" ; start-stop-daemon --stop --quiet --oknodo --exec /sbin/portmap
        echo "."
	;;
    reload)
	;;
    force-reload)
        $0 restart
	;;
    restart)
	pmap_dump >/var/run/portmap.state
        $0 stop
        $0 start
	if [ ! -f /var/run/portmap.upgrade-state ]; then
          sleep 1
	  pmap_set </var/run/portmap.state
	fi
	rm -f /var/run/portmap.state
	;;
    *)
	echo "Usage: /etc/init.d/portmap {start|stop|reload|restart}"
	exit 1
	;;
esac

exit 0