[Pkg-samba-maint] Yet another Ubuntu patch: adding a status section to init script

Christian Perrier bubulle at debian.org
Sat Mar 15 12:55:17 UTC 2008


Here's another patch from Ubuntu's 3.0.28a-0ubuntu1.

It basically adds a "status" section to the init script, claiming to
make it compliant with LSB.

I wasn't aware of such requirement but this basically doesn't really
hurt, so I'm tempted to adopt this for 3.0.28a-2...

Again, comments?

Please note that using $DAEMON seems overzealous here.

Also, "pidofproc" doesn't seem to be available in Debian. That appear
to be an Ubutuism.....but we could do the same with "pidof".

--- ../../../samba-3.0.28a/debian/samba.init	2008-03-09 08:28:00.606166910 +0100
+++ samba.init	2008-03-15 11:40:21.000000000 +0100
@@ -16,6 +16,7 @@
 # Reads config file (will override defaults above)
 [ -r /etc/default/samba ] && . /etc/default/samba
 
+DAEMON=/usr/sbin/smbd
 PIDDIR=/var/run/samba
 NMBDPID=$PIDDIR/nmbd.pid
 SMBDPID=$PIDDIR/smbd.pid
@@ -96,8 +97,18 @@
 		sleep 1
 		$0 start
 		;;
+	status)
+		pidofproc -p $SMBDPID $DAEMON >/dev/null
+		status=$?
+		if [ $status -eq 0 ]; then
+			log_success_msg "SMBD is running"
+		else
+			log_failure_msg "SMBD is not running"
+		fi
+		exit $status
+		;;
 	*)
-		echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload}"
+		echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload|status}"
 		exit 1
 		;;
 esac


-- 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-samba-maint/attachments/20080315/9ac9047e/attachment.pgp 


More information about the Pkg-samba-maint mailing list