#!/bin/sh -e
#
# ugidd		Startup script for the ugidd server.
#
#		Modified for ugidd
#		by Herbert Xu <herbert@debian.org>
#		Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#		Modified for Debian GNU/Linux
#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version:	$Id: ugidd.init,v 1.4 1999/11/17 01:30:22 herbert Exp $

### BEGIN INIT INFO
# Provides:		ugidd
# Required-Start:	$network
# Required-Stop:	$network
# Default-Start:	2 3 4 5
# Default-Stop:		0 1 6
# Short-Description:	Startup script for the ugidd server.
### END INIT INFO

DESC="UID mapping server"

test -x /sbin/rpc.ugidd || exit 0

start_stop() {
	case "$1" in
	start)
		# We need this as ugidd is started before the usual
		# starting time of portmap.
		/etc/init.d/portmap start
		printf "Starting $DESC:"
		start-stop-daemon --start --quiet \
				  --exec /sbin/rpc.ugidd
		printf " ugidd"
		printf ".\n"
		;;
	stop)
		printf "Stopping $DESC:"
		start-stop-daemon --stop --oknodo --quiet \
				  --exec /sbin/rpc.ugidd
		printf " ugidd"
		printf ".\n"
		;;
	restart | force-reload)
		start_stop stop
		sleep 1
		start_stop start
		;;
	*)
		printf "Usage: $0 {start|stop|restart|force-reload}\n" >&2
		exit 1
		;;
	esac
}

start_stop "$@"

exit 0
