SOURCES: nfslock.init - added options to set tcp and udp ports for...

baggins baggins at pld-linux.org
Tue Mar 20 16:15:00 CET 2007


Author: baggins                      Date: Tue Mar 20 15:15:00 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- added options to set tcp and udp ports for lockd and statd
- changed chckonfig levels

---- Files affected:
SOURCES:
   nfslock.init (1.13 -> 1.14) 

---- Diffs:

================================================================
Index: SOURCES/nfslock.init
diff -u SOURCES/nfslock.init:1.13 SOURCES/nfslock.init:1.14
--- SOURCES/nfslock.init:1.13	Thu Oct 19 12:33:06 2006
+++ SOURCES/nfslock.init	Tue Mar 20 16:14:55 2007
@@ -3,7 +3,7 @@
 # nfslock	This shell script takes care of starting and stopping
 #		the NFS file locking service.
 #
-# chkconfig:	345 61 19
+# chkconfig:	345 14 81
 # description:	NFS is a popular protocol for file sharing across \
 #		TCP/IP networks. This service provides NFS file \
 #		locking functionality.
@@ -32,9 +32,23 @@
 	[ -z "`/sbin/pidof portmap`" ] && nls "Error: portmap isn't running" && exit 0
 fi
 
+# /usr may be on NFS, fail silently, nfsfs will start it
+[ -x /usr/sbin/rpc.statd ] || exit 0
+
 start() {
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/nfslock ]; then
+		# Set the ports lockd should listen on
+		if [ -n "$LOCKD_TCPPORT" ]; then
+			/sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
+		fi
+		if [ -n "$LOCKD_UDPPORT" ]; then
+			/sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1
+		fi
+
+		[ -n "$STATD_PORT" ] && STATDOPTS="$STATDOPTS -p $STATD_PORT"
+		[ -n "$STATD_OUTPORT" ] && STATDOPTS="$STATDOPTS -o $STATD_OUTPORT"
+
 		# Start daemons.
 		msg_starting "NFS statd"
 		daemon rpc.statd $STATDOPTS
@@ -47,6 +61,13 @@
 
 stop() {
 	if [ -f /var/lock/subsys/nfslock ]; then
+		# Reset the lockd ports if they were set
+		if [ -n "$LOCKD_TCPPORT" ]; then
+			/sbin/sysctl -w fs.nfs.nlm_tcpport=0 >/dev/null 2>&1
+		fi
+		if [ -n "$LOCKD_UDPPORT" ]; then
+			/sbin/sysctl -w fs.nfs.nlm_udpport=0 >/dev/null 2>&1
+		fi
 		# Stop daemons.
 		msg_stopping "NFS statd"
 		killproc rpc.statd
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/nfslock.init?r1=1.13&r2=1.14&f=u



More information about the pld-cvs-commit mailing list