diff options
author | ccsmart <ccsmart@smartpal.de> | 2005-07-10 08:39:33 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2005-07-10 08:39:33 +0000 |
commit | 818a6fea32eabad2804f6eda87cef7b2a3191cc0 (patch) | |
tree | 8ce6ce9337b8359159019527d68699c9adc3ac84 /packages/nfs-utils/files/nfsserver | |
parent | 6192d03272f2a940e803cc00d4989949953e03f9 (diff) | |
parent | 8488fd8493e249c8dc7d02d4fcb10cdbf16aba6d (diff) |
merge of 0aff07c0ec1ad6cd2825cb3f73fa8ea5948359e8
and b6beeff01c7a8b7ba6cf72a1a343d02c084f71b9
Diffstat (limited to 'packages/nfs-utils/files/nfsserver')
-rw-r--r-- | packages/nfs-utils/files/nfsserver | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/packages/nfs-utils/files/nfsserver b/packages/nfs-utils/files/nfsserver new file mode 100644 index 0000000000..3536f0db12 --- /dev/null +++ b/packages/nfs-utils/files/nfsserver @@ -0,0 +1,106 @@ +#!/bin/sh +# +# Startup script for nfs-utils +# +# The nfsd kernel module must exist along with its dependencies +modprobe -n nfsd || exit 0 +# +# The environment variable NFS_SERVERS may be set in /etc/default/nfsd +# Other control variables may be overridden here too +test -r /etc/default/nfsd && . /etc/default/nfsd +# +# Location of exectuables: +test -x "$NFS_MOUNTD" || NFS_MOUNTD=/usr/sbin/mountd +test -x "$NFS_NFSD" || NFS_NFSD=/usr/sbin/nfsd +# +# The user mode program must also exist (it just starts the kernel +# threads using the kernel module code). +test -x "$NFS_MOUNTD" || exit 0 +test -x "$NFS_NFSD" || exit 0 +# +# Default is 8 threads, value is settable between 1 and the truely +# ridiculous 99 +test "$NFS_SERVERS" -gt 0 && "$NFS_SERVERS" -lt 100 || NFS_SERVERS=8 +# +#---------------------------------------------------------------------- +# Startup and shutdown functions. +# Actual startup/shutdown is at the end of this file. +#mountd +start_mountd(){ + echo -n 'starting mountd: ' + start-stop-daemon --start --exec "$NFS_MOUNTD" -- "$@" + echo done +} +stop_mountd(){ + echo -n 'stopping mountd: ' + start-stop-daemon --stop --quiet --exec "$NFS_MOUNTD" + echo done +} +# +#nfsd +start_nfsd(){ + echo -n 'starting $1 nfsd kernel threads: ' + start-stop-daemon --start --exec "$NFS_NFSD" -- "$@" + echo done +} +delay_nfsd(){ + for delay in 0 1 2 3 4 5 6 7 8 9 + do + if pidof nfsd >/dev/null + then + echo -n . + sleep 1 + else + return 0 + fi + done + return 1 +} +stop_nfsd(){ + # WARNING: this kills any process with the executable + # name 'nfsd'. + echo -n 'stopping nfsd: ' + start-stop-daemon --stop --quiet --signal 1 --name nfsd + if delay_nfsd || { + echo failed + echo ' using signal 9: ' + start-stop-daemon --stop --quiet --signal 9 --name nfsd + delay_nfsd + } + then + echo done + # This will remove, recursively, dependencies + echo -n 'removing nfsd kernel module: ' + if modprobe -r nfsd + then + echo done + else + echo failed + fi + else + echo failed + fi +} +#---------------------------------------------------------------------- +# +# supported options: +# start +# stop +# reload: reloads the exports file +# restart: stops and starts mountd +#FIXME: need to create the /var/lib/nfs/... directories +case "$1" in +start) start_nfsd "$NFS_SERVERS" + start_mountd + test -r /etc/exports && exportfs -a;; +stop) exportfs -ua + stop_mountd + stop_nfsd;; +reload) test -r /etc/exports && exportfs -r;; +restart)exportfs -ua + stop_mountd + # restart does not restart the kernel threads, + # only the user mode processes + start_mountd + test -r /etc/exports && exportfs -a;; +esac |