bump version
[buildroot.git] / package / nfs-utils / S60nfs
blob49dab701519ce6f56d94bba1a68a21f42d68effb
1 #!/bin/sh
3 # nfs This shell script takes care of starting and stopping
4 # the NFS services. Stolen from RedHat FC5.
6 [ -x /usr/sbin/rpc.statd ] || exit 0
7 [ -x /usr/sbin/rpc.nfsd ] || exit 0
8 [ -x /usr/sbin/rpc.mountd ] || exit 0
9 [ -x /usr/sbin/exportfs ] || exit 0
11 # Don't fail if /etc/exports doesn't exist; create a bare-bones version and continue.
12 [ -r /etc/exports ] || \
13 { touch /etc/exports && chmod u+rw,g+r,o+r /etc/exports ; } || \
14 { echo "/etc/exports does not exist" ; exit 0 ; }
16 # The /var/lib/nfs directory is actually on a tmpfs filesystem.
17 mkdir -p /var/lib/nfs/sm
18 mkdir -p /var/lib/nfs/sm.bak
19 touch /var/lib/nfs/etab
20 touch /var/lib/nfs/rmtab
21 touch /var/lib/nfs/state
22 touch /var/lib/nfs/xtab
24 start() {
25 # Start daemons.
26 echo -n "Starting NFS statd: "
27 rpc.statd
28 touch /var/lock/subsys/nfslock
29 echo "done"
31 echo -n "Starting NFS services: "
32 /usr/sbin/exportfs -r
33 rpc.statd
34 echo "done"
36 echo -n "Starting NFS daemon: "
37 rpc.nfsd 2
38 echo "done"
40 echo -n "Starting NFS mountd: "
41 rpc.mountd
42 echo "done"
43 touch /var/lock/subsys/nfs
46 stop() {
47 # Stop daemons.
48 echo -n "Shutting down NFS mountd: "
49 killall -q rpc.mountd
50 echo "done"
52 echo "Shutting down NFS daemon: "
53 kill -9 `pidof nfsd` 2>/dev/null
54 echo "done"
56 echo -n "Shutting down NFS services: "
57 /usr/sbin/exportfs -au
58 rm -f /var/lock/subsys/nfs
59 killall -q rpc.statd
60 echo "done"
62 echo -n "Stopping NFS statd: "
63 killall -q rpc.statd
64 echo "done"
65 rm -f /var/lock/subsys/nfslock
68 # See how we were called.
69 case "$1" in
70 start)
71 start
73 stop)
74 stop
76 restart)
77 stop
78 start
80 reload)
81 /usr/sbin/exportfs -r
82 touch /var/lock/subsys/nfs
85 echo "Usage: nfs {start|stop|reload}"
86 exit 1
87 esac
89 exit 0