xref: /dragonfly/etc/rc.d/statd (revision c541a65d)
1#!/bin/sh
2#
3# FreeBSD History: src/etc/rc.d/nfslocking,v 1.11 2004/10/07 13:55:26 mtm Exp
4# $FreeBSD: src/etc/rc.d/statd,v 1.21 2008/07/16 19:50:29 dougb Exp $
5# $DragonFly$
6#
7
8# PROVIDE: statd
9# REQUIRE: nfsserver nfsclient nfsd rpcbind
10# BEFORE:  DAEMON
11# KEYWORD: nojail shutdown
12
13. /etc/rc.subr
14
15name="statd"
16rcvar=rpc_statd_enable
17command="/usr/sbin/rpc.${name}"
18start_precmd='statd_precmd'
19stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable'
20status_precmd=$stop_precmd
21
22# Make sure that we are either an NFS client or server, and that we get
23# the correct flags from rc.conf(5).
24#
25statd_precmd()
26{
27	local ret
28	ret=0
29
30	if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable
31	then
32		ret=1
33	fi
34	if ! checkyesno rpcbind_enable && \
35	    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
36	then
37		force_depend rpcbind || ret=1
38	fi
39	rc_flags=${rpc_statd_flags}
40	return ${ret}
41}
42
43load_rc_config $name
44run_rc_command $1
45