Skip to contentSkip to conversation

Package nfs-utils: Start/stop daemons consistently

PATCH New Maxime Hadjinlian 3 participants 6 messages Jul 3, 2016 – Jul 6, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Package nfs-utils: Start/stop daemons consistently

From: universe II <[email protected]>

Changed 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.

[Maxime:
- Make it really consistent to stop the daemons as pointed out by Yann E. Morin
- Remove the -9]

---
 package/nfs-utils/S60nfs | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
package/nfs-utils/S60nfs +6 -6
index 7a49c79..2d4e082 100755
@@ -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
 
Signature · 1 line
2.8.1
#1 lore raw

PATCH 2/2 package/nfs-utils: Fix indent

Use tabs everywhere still we don't have an official policy.

---
 package/nfs-utils/S60nfs | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)
package/nfs-utils/S60nfs +18 -18
index 2d4e082..893b1e4 100755
@@ -17,7 +17,7 @@ CFG_FILE=/etc/default/nfsd
 
 NR_THREADS=2
 if [ -f "${CFG_FILE}" ]; then
-    . "${CFG_FILE}"
+	. "${CFG_FILE}"
 fi
 
 
@@ -66,23 +66,23 @@ stop() {
 
 # See how we were called.
 case "$1" in
-  start)
-	start
-	;;
-  stop)
-	stop
-	;;
-  restart)
-	stop
-	start
-	;;
-  reload)
-	/usr/sbin/exportfs -r
-	touch /var/lock/subsys/nfs
-	;;
-  *)
-	echo "Usage: $0 {start|stop|restart|reload}"
-	exit 1
+	start)
+		start
+		;;
+	stop)
+		stop
+		;;
+	restart)
+		stop
+		start
+		;;
+	reload)
+		/usr/sbin/exportfs -r
+		touch /var/lock/subsys/nfs
+		;;
+	*)
+		echo "Usage: $0 {start|stop|restart|reload}"
+		exit 1
 esac
 
 exit 0
Signature · 1 line
2.8.1
#2 lore raw

PATCH 2/2 package/nfs-utils: Fix indent

Hello,

Quoted 3 lines · Maxime Hadjinlian

Use tabs everywhere still we don't have an official policy.

I think we say "fix indentation" not "fix indent".

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH 1/2 Package nfs-utils: Start/stop daemons consistently

In reply to Maxime Hadjinlian

Hello,

Title should be:

package/nfs-utils: start/stop daemons consistently

Quoted 1 line · Maxime Hadjinlian

From: universe II <[email protected]>

Please fix this "From" to be consistent with the Signed-off-by. I forgot about it when applying the previous patches from Andreas.

Quoted 2 lines

Changed init script to start and stop all nfs daemons

Please use the present "Change" and not the past "Changed". I don't understand why people use the past tense in commit logs.

Quoted 7 lines

in a consistent way. Using the same kill command, start/stop the daemon, printout OK or FAIL and touch or deleted necessary files.

[Maxime:
- Make it really consistent to stop the daemons as pointed out by Yann E. Morin

Line too long, no? :)

Quoted 39 lines

- Remove the -9]

---
 package/nfs-utils/S60nfs | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
package/nfs-utils/S60nfs +5 -5
index 7a49c79..2d4e082 100755
@@ -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
 }
 

package/nfs-utils/S60nfs case "$1" in · line 87

Quoted 8 lines
package/nfs-utils/S60nfs +1 -1
@@ -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
 

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/2 Package nfs-utils: Start/stop daemons consistently

Dear all,
thanks for revising the patch series. As requested I will use the present instead of the past in the future :-)

Regards,
Andreas

Am 03.07.2016 um 18:53 schrieb Thomas Petazzoni:

Quoted 72 lines

Hello,

Title should be:

package/nfs-utils: start/stop daemons consistently

Quoted 1 line · Maxime Hadjinlian

From: universe II <[email protected]>

Please fix this "From" to be consistent with the Signed-off-by. I forgot about it when applying the previous patches from Andreas.

Quoted 1 line

Changed init script to start and stop all nfs daemons

Please use the present "Change" and not the past "Changed". I don't understand why people use the past tense in commit logs.

Quoted 7 lines

in a consistent way. Using the same kill command, start/stop the daemon, printout OK or FAIL and touch or deleted necessary files.

[Maxime:
- Make it really consistent to stop the daemons as pointed out by Yann E. Morin

Line too long, no? :)

Quoted 39 lines

- Remove the -9]

---
  package/nfs-utils/S60nfs | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)
package/nfs-utils/S60nfs +5 -5
index 7a49c79..2d4e082 100755
@@ -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
  }
 

package/nfs-utils/S60nfs case "$1" in · line 87

Quoted 8 lines
package/nfs-utils/S60nfs +1 -1
@@ -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
 

Thomas

#5 lore raw

PATCH 1/2 Package nfs-utils: Start/stop daemons consistently

In reply to Maxime Hadjinlian

Hello,

Quoted 7 lines · Maxime Hadjinlian

From: universe II <[email protected]>

Changed 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.

Quoted 8 lines

[Maxime:
- Make it really consistent to stop the daemons as pointed out by Yann E. Morin
- Remove the -9]

---
 package/nfs-utils/S60nfs | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Both applied, with minor tweaks. Regarding the second patch, I really wasn't sure since we don't have written rules about indentation in our init scripts, it's the kind of things that tends to get changed in one direction, and then in the other direction a few months later. But anyway, since the patch was done, I applied it.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com