xref: /freebsd/libexec/rc/rc.d/ypserv (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6# PROVIDE: ypserv
7# REQUIRE: rpcbind
8# KEYWORD: shutdown
9
10. /etc/rc.subr
11
12name="ypserv"
13desc="NIS database server"
14rcvar="nis_server_enable"
15
16load_rc_config $name
17
18command="/usr/sbin/${name}"
19command_args="${nis_server_flags}"
20
21start_precmd="ypserv_prestart"
22
23ypserv_prestart()
24{
25	local _domain
26
27	force_depend rpcbind || return 1
28
29	_domain=`domainname`
30	if [ -z "$_domain" ]; then
31		warn "NIS domainname(1) is not set."
32		return 1
33	fi
34	if [ ! -d /var/yp/$_domain/. ]; then
35		warn "/var/yp/$_domain is not a directory."
36		return 1
37	fi
38}
39
40run_rc_command "$1"
41