summaryrefslogtreecommitdiffstats
path: root/network/unfs3/rc.unfsd
diff options
context:
space:
mode:
Diffstat (limited to 'network/unfs3/rc.unfsd')
-rw-r--r--network/unfs3/rc.unfsd66
1 files changed, 66 insertions, 0 deletions
diff --git a/network/unfs3/rc.unfsd b/network/unfs3/rc.unfsd
new file mode 100644
index 0000000000..e78b81a91e
--- /dev/null
+++ b/network/unfs3/rc.unfsd
@@ -0,0 +1,66 @@
+#!/bin/sh
+# Start/stop/restart the UNFS server.
+#
+# This is an init script for the User-mode NFS daemon.
+#
+# To use NFS, you must first set up /etc/exports.
+# See unfsd(8) for information on /etc/exports format.
+#
+# Written for Slackware Linux' knfsd by Patrick J. Volkerding <volkerdi@slackware.com>.
+# Modified to use unfsd by Menno E. Duursma <druiloor@zonnet.nl>
+
+unfsd_start() {
+ # Sanity checks. Exit if there's no /etc/exports, or if there aren't any
+ # shares defined in it.
+ if [ ! -r /etc/exports ]; then # no config file, exit:
+ exit
+ elif ! grep -v -e '^#' -e '^$' /etc/exports | grep -q '/' ; then
+ exit # no uncommented shares in /etc/exports
+ fi
+
+ echo -n "Starting UNFS server daemon(s):"
+
+ if [ -x /sbin/rpc.portmap ]; then
+ if ! ps axc | grep -q rpc.portmap ; then
+ echo -n " /sbin/rpc.portmap"
+ /sbin/rpc.portmap
+ fi
+
+ if [ -x /usr/sbin/unfsd ]; then
+ echo " /usr/sbin/nfsd"
+ /usr/sbin/unfsd
+ fi
+ else
+ echo "WARNING: Cannot start RPC portmapper daemon needed for UNFS."
+ echo " /sbin/rpc.portmap (a required daemon) is not executable"
+ echo " or is not present on your system."
+ echo
+ fi
+}
+
+unfsd_stop() {
+ echo "Stopping UNFS server daemon..."
+ killall unfsd 2> /dev/null
+ sleep 1
+ killall -9 unfsd 2> /dev/null # make sure :)
+}
+
+unfsd_restart() {
+ unfsd_stop
+ sleep 1
+ unfsd_start
+}
+
+case "$1" in
+'start')
+ unfsd_start
+ ;;
+'stop')
+ unfsd_stop
+ ;;
+'restart')
+ unfsd_restart
+ ;;
+*)
+ echo "usage $0 start|stop|restart"
+esac