summaryrefslogtreecommitdiff
path: root/sys-freebsd/freebsd-usbin/files/nfs.initd
diff options
context:
space:
mode:
Diffstat (limited to 'sys-freebsd/freebsd-usbin/files/nfs.initd')
-rw-r--r--sys-freebsd/freebsd-usbin/files/nfs.initd54
1 files changed, 54 insertions, 0 deletions
diff --git a/sys-freebsd/freebsd-usbin/files/nfs.initd b/sys-freebsd/freebsd-usbin/files/nfs.initd
new file mode 100644
index 000000000000..17974ca0998a
--- /dev/null
+++ b/sys-freebsd/freebsd-usbin/files/nfs.initd
@@ -0,0 +1,54 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+#---------------------------------------------------------------------------
+# This script starts/stops nfsd and mountd
+# Daemons rpc.rquotad, rpc.rstatd, rpc.rusersd, rpc.rwalld and rpc.sprayd
+# should be started from inetd on FreeBSD.
+#---------------------------------------------------------------------------
+
+extra_started_commands="reload"
+
+# The binary locations
+nfsd=/usr/sbin/nfsd
+mountd=/usr/sbin/mountd
+
+depend() {
+ use ypbind net rpc.lockd
+ need rpcbind
+ after quota
+}
+
+start() {
+ ebegin "Starting NFS daemon"
+ start-stop-daemon --start --quiet --exec \
+ $nfsd -- ${nfsdopts}
+ eend $? "Error starting NFS daemon"
+
+ # Start mountd
+ ebegin "Starting NFS mountd"
+ start-stop-daemon --start --quiet --exec \
+ $mountd -- ${mountdopts} ${exportsfile}
+ eend $? "Error starting NFS mountd"
+}
+
+stop() {
+ ebegin "Stopping NFS mountd"
+ start-stop-daemon --stop --quiet --exec $mountd \
+ --pidfile /var/run/mountd.pid
+ eend $? "Error stopping NFS mountd"
+
+ ebegin "Stopping NFS daemon"
+ start-stop-daemon --stop --signal USR1 --quiet \
+ --name nfsd --user root
+ eend $? "Error stopping NFS daemon"
+}
+
+reload() {
+ # Hangup signal to mountd reloads /etc/exports.
+ ebegin "Reloading /etc/exports"
+ start-stop-daemon --signal 1 --quiet --exec $mountd \
+ --pidfile /var/run/mountd.pid
+ eend $?
+}