nfsd revision 223847
178344Sobrien#!/bin/sh 278344Sobrien# 398184Sgordon# $FreeBSD: head/etc/rc.d/nfsd 223847 2011-07-07 20:59:42Z rmacklem $ 478344Sobrien# 578344Sobrien 678344Sobrien# PROVIDE: nfsd 7193354Srmacklem# REQUIRE: mountd hostname gssd nfsuserd 8180564Sdougb# KEYWORD: nojail shutdown 978344Sobrien 1078344Sobrien. /etc/rc.subr 1178344Sobrien 1278344Sobrienname="nfsd" 1398184Sgordonrcvar=`set_rcvar nfs_server` 1499550Sgordoncommand="/usr/sbin/${name}" 1578344Sobrien 16109770Smtmload_rc_config $name 17124622Smtmstart_precmd="nfsd_precmd" 18124622Smtmsig_stop="USR1" 1998184Sgordon 2098184Sgordonnfsd_precmd() 2198184Sgordon{ 22221046Srmacklem if checkyesno oldnfs_server_enable; then 23221046Srmacklem rc_flags="-o ${nfs_server_flags}" 24193354Srmacklem 25223847Srmacklem # Load the module now, so that the vfs.nfsrv sysctl 26223847Srmacklem # oids are available. 27223847Srmacklem load_kld nfsserver 28193354Srmacklem 29193354Srmacklem if checkyesno nfs_reserved_port_only; then 30193354Srmacklem echo 'NFS on reserved port only=YES' 31193354Srmacklem sysctl vfs.nfsrv.nfs_privport=1 > /dev/null 32193354Srmacklem fi 33221046Srmacklem else 34221046Srmacklem rc_flags="${nfs_server_flags}" 35221046Srmacklem 36221615Srmacklem # Load the modules now, so that the vfs.nfsd sysctl 37221046Srmacklem # oids are available. 38221046Srmacklem load_kld nfsd 39221046Srmacklem 40221046Srmacklem if checkyesno nfs_reserved_port_only; then 41221046Srmacklem echo 'NFS on reserved port only=YES' 42221615Srmacklem sysctl vfs.nfsd.nfs_privport=1 > /dev/null 43221046Srmacklem fi 44221046Srmacklem 45221046Srmacklem if checkyesno nfsv4_server_enable; then 46221046Srmacklem if ! checkyesno nfsuserd_enable && \ 47221046Srmacklem ! /etc/rc.d/nfsuserd forcestatus 1>/dev/null 2>&1 48221046Srmacklem then 49221046Srmacklem if ! force_depend nfsuserd; then 50221046Srmacklem err 1 "Cannot run nfsuserd" 51221046Srmacklem fi 52221046Srmacklem fi 53221046Srmacklem else 54221046Srmacklem echo 'NFSv4 is disabled' 55221615Srmacklem sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null 56221046Srmacklem fi 5798184Sgordon fi 5898184Sgordon 59101851Sgordon if ! checkyesno rpcbind_enable && \ 60101851Sgordon ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 61101851Sgordon then 62101851Sgordon force_depend rpcbind || return 1 63101851Sgordon fi 64101851Sgordon 65101851Sgordon if ! checkyesno mountd_enable && \ 66101851Sgordon ! /etc/rc.d/mountd forcestatus 1>/dev/null 2>&1 67101851Sgordon then 68101851Sgordon force_depend mountd || return 1 69101851Sgordon fi 7098184Sgordon return 0 7198184Sgordon} 7298184Sgordon 7378344Sobrienrun_rc_command "$1" 74