package/nfs-utils: start/stop daemons consistently
authorAndreas Ehmanns <universeII@gmx.de>
Sun, 3 Jul 2016 16:46:58 +0000 (18:46 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 4 Jul 2016 09:32:49 +0000 (11:32 +0200)
Change init script to start and stop all nfs daemons in a consistent
way. Using the same kill command, start/stop the daemon, printout OK or
FAIL and touch or deleted necessary files.

Signed-off-by: Andreas Ehmanns <universeII@gmx.de>
[Maxime:
   - Make it really consistent to stop the daemons as pointed out by
     Yann E. Morin
   - Remove the -9]
Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/nfs-utils/S60nfs

index 7a49c798007277680fbec0910015ed6ab32ed043..2d4e082a0b3fac65113cbb022a919173b5c19b55 100755 (executable)
@@ -45,22 +45,22 @@ start() {
 stop() {
        # Stop daemons.
        printf "Shutting down NFS mountd: "
-       killall -q rpc.mountd
+       killall -q rpc.mountd 2>/dev/null
        [ $? = 0 ] && echo "OK" || echo "FAIL"
 
        printf "Shutting down NFS daemon: "
-       kill -9 `pidof nfsd` 2>/dev/null
+       killall -q nfsd 2>/dev/null
        [ $? = 0 ] && echo "OK" || echo "FAIL"
 
        printf "Shutting down NFS services: "
        /usr/sbin/exportfs -au
-       rm -f /var/lock/subsys/nfs
-       killall -q rpc.statd
        [ $? = 0 ] && echo "OK" || echo "FAIL"
 
        printf "Stopping NFS statd: "
-       killall -q rpc.statd
+       killall -q rpc.statd 2>/dev/null
        [ $? = 0 ] && echo "OK" || echo "FAIL"
+       rm -f /var/lock/subsys/nfs
+       rm -f /var/run/rpc.statd.pid
        rm -f /var/lock/subsys/nfslock
 }
 
@@ -81,7 +81,7 @@ case "$1" in
        touch /var/lock/subsys/nfs
        ;;
   *)
-       echo "Usage: nfs {start|stop|reload}"
+       echo "Usage: $0 {start|stop|restart|reload}"
        exit 1
 esac