wok-stable annotate nfs-utils/stuff/etc/init.d/nfsd @ rev 10360
dbus-glib: can't cross compile
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon May 23 00:13:43 2011 +0200 (2011-05-23) |
parents | |
children |
rev | line source |
---|---|
pascal@7285 | 1 #!/bin/sh |
pascal@7285 | 2 # /etc/init.d/nfsd: Start, stop and restart NFS deamon on SliTaz, at boot |
pascal@7285 | 3 # time or with the command line. |
pascal@7285 | 4 # |
pascal@7285 | 5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS |
pascal@7285 | 6 # variable of /etc/rcS.conf. |
pascal@7285 | 7 # |
pascal@7285 | 8 . /etc/init.d/rc.functions |
pascal@7285 | 9 |
pascal@7285 | 10 NAME=NFSd |
pascal@7285 | 11 DESC="NFS Daemon" |
pascal@7285 | 12 DAEMON=/usr/sbin/rpc.nfsd |
pascal@7285 | 13 PID_FILE=/var/run/nfsd.pid |
pascal@7285 | 14 OPTION="8" |
pascal@7285 | 15 [ -n "$NFSD_OPTION" ] || OPTION="$NFSD_OPTION" |
pascal@7285 | 16 |
pascal@7285 | 17 stop_warning() |
pascal@7285 | 18 { |
pascal@7285 | 19 echo "Warning: filesystems are unexported but nfsd and lockd processes are still alive..." |
pascal@7285 | 20 } |
pascal@7285 | 21 |
pascal@7285 | 22 case "$1" in |
pascal@7285 | 23 start) |
pascal@7285 | 24 if active_pidfile $PID_FILE nfsd ; then |
pascal@7285 | 25 echo "$NAME already running." |
pascal@7285 | 26 exit 1 |
pascal@7285 | 27 fi |
pascal@7285 | 28 echo -n "Starting $DESC: $NAME... " |
pascal@7285 | 29 portmap="$(pidof portmap)" |
pascal@7285 | 30 if [ -n "$portmap" ]; then |
pascal@7285 | 31 kill $portmap |
pascal@7285 | 32 sleep 2 |
pascal@7285 | 33 fi |
pascal@7285 | 34 [ -n "$(pidof rpcbind)" ] || rpcbind |
pascal@7285 | 35 modprobe nfsd |
pascal@7285 | 36 mount -t nfsd nfsd /proc/fs/nfsd 2> /dev/null |
pascal@7285 | 37 /usr/sbin/exportfs -r |
pascal@7285 | 38 $DAEMON $OPTION |
pascal@7285 | 39 pidof nfsd | awk '{print $1}' > $PID_FILE |
pascal@7285 | 40 /usr/sbin/rpc.mountd |
pascal@7285 | 41 status |
pascal@7285 | 42 ;; |
pascal@7285 | 43 stop) |
pascal@7285 | 44 if ! active_pidfile $PID_FILE nfsd ; then |
pascal@7285 | 45 echo "$NAME is not running." |
pascal@7285 | 46 exit 1 |
pascal@7285 | 47 fi |
pascal@7285 | 48 echo -n "Stopping $DESC: $NAME... " |
pascal@7285 | 49 killall rpc.mountd |
pascal@7285 | 50 killall nfsd |
pascal@7285 | 51 killall lockd |
pascal@7285 | 52 /usr/sbin/exportfs -au |
pascal@7285 | 53 /usr/sbin/exportfs -f |
pascal@7285 | 54 stop_warning # FIXME |
pascal@7285 | 55 rm $PID_FILE |
pascal@7285 | 56 status |
pascal@7285 | 57 ;; |
pascal@7285 | 58 restart) |
pascal@7285 | 59 if ! active_pidfile $PID_FILE nfsd ; then |
pascal@7285 | 60 echo "$NAME is not running." |
pascal@7285 | 61 exit 1 |
pascal@7285 | 62 fi |
pascal@7285 | 63 echo -n "Restarting $DESC: $NAME... " |
pascal@7285 | 64 killall rpc.mountd |
pascal@7285 | 65 killall nfsd |
pascal@7285 | 66 killall lockd |
pascal@7285 | 67 /usr/sbin/exportfs -au |
pascal@7285 | 68 /usr/sbin/exportfs -f |
pascal@7285 | 69 sleep 2 |
pascal@7285 | 70 /usr/sbin/exportfs -r |
pascal@7285 | 71 $DAEMON $OPTION |
pascal@7285 | 72 pidof nfsd | awk '{print $1}' > $PID_FILE |
pascal@7285 | 73 /usr/sbin/rpc.mountd |
pascal@7285 | 74 status |
pascal@7285 | 75 ;; |
pascal@7285 | 76 *) |
pascal@7285 | 77 echo "" |
pascal@7285 | 78 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
pascal@7285 | 79 echo "" |
pascal@7285 | 80 exit 1 |
pascal@7285 | 81 ;; |
pascal@7285 | 82 esac |
pascal@7285 | 83 |
pascal@7285 | 84 exit 0 |