summaryrefslogtreecommitdiff
blob: 0c8f083aa036c815ed0b207788075904dfa19d9b (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
#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-nds/portmap/files/portmap.rc6,v 1.4 2003/02/14 23:08:56 vapier Exp $

depend() {
	need net
}

start() {
	ebegin "Starting portmap"
	start-stop-daemon --start --quiet --exec /sbin/portmap
	eend $?
	#without, if a service depending on portmap is started too fast,
	#connecting to portmap will fail -- azarah
	sleep 1
}

stop() {
	ebegin "Stopping portmap"
	start-stop-daemon --stop --quiet --exec /sbin/portmap
	eend $?
}

restart() {
	# Dump the portmapper's table before stopping
	ebegin "Saving portmap table"
	local tmpfile=`mktemp /tmp/pmap_table.XXXXXX`
	[ -n "$tmpfile" ] && pmap_dump >$tmpfile
	eend $? "Error saving portmap table."

	# Stop and restart portmapper
	svc_stop
	sleep 1
	svc_start

	# Reload the portmapper's table
	if [ -n "$tmpfile" ]; then
		ebegin "Reloading portmap table"
		pmap_set <$tmpfile
		eend $? "Error reloading portmap table."
		rm -f $tmpfile
	fi
}