slackbuilds_ponce/network/unfs3/rc.unfsd
2010-05-11 15:01:38 +02:00

66 lines
1.5 KiB
Bash

#!/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