Skip to contentSkip to conversation

Add status command for LSB compliance for some packages

PATCH Superseded [email protected] 4 participants 13 messages Aug 20, 2013 – Aug 22, 2013

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Add status command for LSB compliance for some packages

From: Jackie Huang <[email protected]>

test info:
MACHINE ??= "qemux86-64"
IMAGE_INSTALL_append = " at sysklogd"

$ bitbake core-image-sato
root@qemux86-64:~# /etc/init.d/atd status
/usr/sbin/atd (pid 580) is running...
root@qemux86-64:~# /etc/init.d/syslog status
syslogd (pid 695) is running...
klogd (pid 697) is running...
root@qemux86-64:~# /etc/init.d/nfsserver status
/usr/sbin/rpc.mountd (pid 685) is running...
nfsd (pid 683 682 681 680 679 678 677 676) is running...
root@qemux86-64:~# /etc/init.d/bootlogd status
/sbin/bootlogd is stopped
root@qemux86-64:~# /etc/init.d/dbus-1 status
/usr/bin/dbus-daemon (pid 704 589) is running...
root@qemux86-64:~# /etc/init.d/sshd status
/usr/sbin/sshd (pid 627) is running...

--
The following changes since commit 57662d4f813d5795cac1529633db80a09efdb089:

meta-skeleton: Add busybox config fragment example (2013-08-13 23:03:44 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib jhuang0/r_status_for_daemons_0820_0
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=jhuang0/r_status_for_daemons_0820_0

Jackie Huang (6):
dbus: add init.d/dbus-1 status command for LSB compliance
sysvinit: add init.d/bootlogd status command for LSB compliance
nfs-utils: add init.d/nfsserver status command for LSB compliance
openssh: add init.d/sshd status command for LSB compliance
sysklogd: add init.d/syslog status command for LSB compliance
at: add init.d/atd status command for LSB compliance

 .../nfs-utils/nfs-utils/nfsserver                  |   25 ++++++++++++++++-
 .../openssh/openssh-6.2p2/init                     |   15 ++++++++++-
 meta/recipes-core/dbus/dbus-1.6.10/dbus-1.init     |    9 +++++-
 meta/recipes-core/sysvinit/sysvinit/bootlogd.init  |   28 +++++++++++++++++---
 meta/recipes-extended/at/files/S99at               |   13 ++++++++-
 meta/recipes-extended/sysklogd/files/sysklogd      |   13 ++++++++-
 6 files changed, 93 insertions(+), 10 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/6 dbus: add init.d/dbus-1 status command for LSB compliance

From: Jackie Huang <[email protected]>

---
 meta/recipes-core/dbus/dbus-1.6.10/dbus-1.init |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
meta/recipes-core/dbus/dbus-1.6.10/dbus-1.init +8 -1
index 0351190..04025e6 100644
@@ -16,6 +16,9 @@
 
 set -e
 
+# Source function library.
+. /etc/init.d/functions
+
 DAEMON=@bindir@/dbus-daemon
 NAME=dbus
 DAEMONUSER=messagebus           # must match /etc/dbus-1/system.conf
@@ -99,6 +102,10 @@ case "$1" in
   stop)
     shut_it_down
   ;;
+  status)
+    status $DAEMON
+    exit $?
+  ;;
   reload|force-reload)
     reload_it
   ;;
@@ -108,7 +115,7 @@ case "$1" in
     start_it_up
   ;;
   *)
-    echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload}" >&2
+    echo "Usage: /etc/init.d/$NAME {start|stop|status|restart|reload|force-reload}" >&2
     exit 1
   ;;
 esac
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/6 sysvinit: add init.d/bootlogd status command for LSB compliance

In reply to [email protected]

From: Jackie Huang <[email protected]>

---
 meta/recipes-core/sysvinit/sysvinit/bootlogd.init |   28 ++++++++++++++++++---
 1 files changed, 24 insertions(+), 4 deletions(-)
meta/recipes-core/sysvinit/sysvinit/bootlogd.init +24 -4
index f8f07a0..455d001 100755
@@ -13,6 +13,9 @@ DAEMON=/sbin/bootlogd
 NAME=bootlogd
 DESC="Bootlog daemon"
 
+# source function library
+. /etc/init.d/functions
+
 test -f $DAEMON || exit 0
 
 [ -r /etc/default/bootlogd ] && . /etc/default/bootlogd
@@ -37,6 +40,19 @@ case "$0" in
 		;;
 esac
 
+# default /var/log/boot is not an option since /var/log becomes
+# /var/volatile/log
+logfile=/var/local/bootlogd.log
+
+#
+# Create initial log files
+#
+if [ ! -f "$logfile" ] && touch "$logfile" >/dev/null 2>&1; then
+	echo "(Nothing has been logged yet.)" >| "$logfile"
+	chown root:adm "$logfile"
+	chmod 640 "$logfile"
+fi
+
 case "$ACTION" in
 	start)
 		echo -n "Starting $DESC: "
@@ -44,9 +60,9 @@ case "$ACTION" in
 		then
 			umask 027
 			start-stop-daemon --start --quiet \
-				--exec $DAEMON -- -r
+				--exec $DAEMON -- -r -l $logfile
 		else
-			$DAEMON -r
+			$DAEMON -r -l $logfile
 		fi
 		echo "$NAME."
 		;;
@@ -70,13 +86,17 @@ case "$ACTION" in
 		echo -n "Restarting $DESC: "
 		start-stop-daemon --stop --quiet --exec $DAEMON
 		sleep 1
-		start-stop-daemon --start --quiet --exec $DAEMON
+		start-stop-daemon --start --quiet --exec $DAEMON -- -l $logfile
 		echo "$NAME."
 		;;
+	status)
+		status $DAEMON
+		exit $?
+		;;
 	*)
 		N=${0##*/}
 		N=${N#[SK]??}
-		echo "Usage: $N {start|stop|restart|force-reload}" >&2
+		echo "Usage: $N {start|stop|status|restart|force-reload}" >&2
 		exit 1
 		;;
 esac
Signature · 1 line
1.7.4.1
#3 lore raw

Re: [PATCH 2/6] sysvinit: add init.d/bootlogd status command for LSB compliance

Quoted 22 lines · On Tue, 2013-08-20 at 11:25 +0800, [email protected] wrote:
meta/recipes-core/sysvinit/sysvinit/bootlogd.init +13 -0
@@ -37,6 +40,19 @@ case "$0" in
 		;;
 esac
 
+# default /var/log/boot is not an option since /var/log becomes
+# /var/volatile/log
+logfile=/var/local/bootlogd.log
+
+#
+# Create initial log files
+#
+if [ ! -f "$logfile" ] && touch "$logfile" >/dev/null 2>&1; then
+	echo "(Nothing has been logged yet.)" >| "$logfile"
+	chown root:adm "$logfile"
+	chmod 640 "$logfile"
+fi
+
 case "$ACTION" in
 	start)
 		echo -n "Starting $DESC: "
@@ -44,9 +60,9 @@ case "$ACTION" in
 		then

meta/recipes-core/sysvinit/sysvinit/bootlogd.init case "$ACTION" in · line 68

Quoted 10 lines
meta/recipes-core/sysvinit/sysvinit/bootlogd.init +2 -2
 			umask 027
 			start-stop-daemon --start --quiet \
-				--exec $DAEMON -- -r
+				--exec $DAEMON -- -r -l $logfile
 		else
-			$DAEMON -r
+			$DAEMON -r -l $logfile
 		fi
 		echo "$NAME."
 		;;

It's not totally obvious that the changes are related to the "status" command. If you're creating new logfiles that didn't exist previously then I think the commit message ought to explain why.

p.

author
#4 lore raw

Re: [PATCH 2/6] sysvinit: add init.d/bootlogd status command for LSB compliance

Quoted 29 lines · Phil Blundell
Quoted 28 lines · On Tue, 2013-08-20 at 11:25 +0800, [email protected] wrote:
meta/recipes-core/sysvinit/sysvinit/bootlogd.init +14 -2
@@ -37,6 +40,19 @@ case "$0" in
  		;;
  esac
 
+# default /var/log/boot is not an option since /var/log becomes
+# /var/volatile/log
+logfile=/var/local/bootlogd.log
+
+#
+# Create initial log files
+#
+if [ ! -f "$logfile" ] && touch "$logfile" >/dev/null 2>&1; then
+	echo "(Nothing has been logged yet.)" >| "$logfile"
+	chown root:adm "$logfile"
+	chmod 640 "$logfile"
+fi
+
  case "$ACTION" in
  	start)
  		echo -n "Starting $DESC: "
@@ -44,9 +60,9 @@ case "$ACTION" in
  		then
  			umask 027
  			start-stop-daemon --start --quiet \
-				--exec $DAEMON -- -r
+				--exec $DAEMON -- -r -l $logfile
  		else
-			$DAEMON -r
Quoted 9 lines

meta/recipes-core/sysvinit/sysvinit/bootlogd.init case "$ACTION" in · line 68

Quoted 4 lines
meta/recipes-core/sysvinit/sysvinit/bootlogd.init +1 -0
+			$DAEMON -r -l $logfile
  		fi
  		echo "$NAME."
  		;;

It's not totally obvious that the changes are related to the "status" command. If you're creating new logfiles that didn't exist previously then I think the commit message ought to explain why.

Sorry, my mistake to involve some other patch when I got the patch from our layer, I will remake the patches.

Thanks,
Jackie

Quoted 5 lines

p.

Signature · 5 lines
Jackie Huang
WIND RIVER | China Development Center
MSN:[email protected]
Tel: +86 8477 8594
Mobile: +86 138 1027 4745
#5 lore raw

PATCH 3/6 nfs-utils: add init.d/nfsserver status command for LSB compliance

In reply to [email protected]

From: Jackie Huang <[email protected]>

---
 .../nfs-utils/nfs-utils/nfsserver                  |   25 ++++++++++++++++++-
 1 files changed, 23 insertions(+), 2 deletions(-)
meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver +23 -2
index e460e26..494af2e 100644
@@ -14,6 +14,8 @@
 #
 # Startup script for nfs-utils
 #
+# Source function library.
+. /etc/init.d/functions
 #
 # The environment variable NFS_SERVERS may be set in /etc/default/nfsd
 # Other control variables may be overridden here too
@@ -23,6 +25,7 @@ test -r /etc/default/nfsd && . /etc/default/nfsd
 test -x "$NFS_MOUNTD" || NFS_MOUNTD=/usr/sbin/rpc.mountd
 test -x "$NFS_NFSD" || NFS_NFSD=/usr/sbin/rpc.nfsd
 test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
+test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid
 #
 # The user mode program must also exist (it just starts the kernel
 # threads using the kernel module code).
@@ -75,6 +78,17 @@ stop_mountd(){
 #
 #nfsd
 start_nfsd(){
+        modprobe -q nfsd
+	grep -q nfsd /proc/filesystems || {
+		echo NFS daemon support not enabled in kernel
+		exit 1
+        }
+	grep -q nfsd /proc/mounts || mount -t nfsd nfsd /proc/fs/nfsd
+	grep -q nfsd /proc/mounts || {
+		echo nfsd filesystem could not be mounted at /proc/fs/nfsd
+		exit 1
+        }
+
 	echo -n "starting $1 nfsd kernel threads: "
 	start-stop-daemon --start --exec "$NFS_NFSD" -- "$@"
 	echo done
@@ -113,14 +127,14 @@ stop_nfsd(){
 #statd
 start_statd(){
 	echo -n "starting statd: "
-	start-stop-daemon --start --exec "$NFS_STATD"
+	start-stop-daemon --start --exec "$NFS_STATD" --pidfile "$STATD_PID"
 	echo done
 }
 stop_statd(){
 	# WARNING: this kills any process with the executable
 	# name 'statd'.
 	echo -n 'stopping statd: '
-	start-stop-daemon --stop --quiet --signal 1 --name statd
+	start-stop-daemon --stop --quiet --signal 1 --pidfile "$STATD_PID"
 	echo done
 }
 #----------------------------------------------------------------------
@@ -141,6 +155,13 @@ stop)	exportfs -ua
 	stop_statd
 	stop_mountd
 	stop_nfsd;;
+status)
+	status /usr/sbin/rpc.mountd;
+	RETVAL=$?
+	status nfsd;
+	rval=$?
+	[ $RETVAL -eq 0 ] && exit $rval
+	exit $RETVAL;;
 reload)	test -r /etc/exports && exportfs -r;;
 restart)exportfs -ua
 	stop_mountd
Signature · 1 line
1.7.4.1
#6 lore raw

Re: [PATCH 3/6] nfs-utils: add init.d/nfsserver status command for LSB compliance

Quoted 33 lines · On Tue, 2013-08-20 at 11:25 +0800, [email protected] wrote:
meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver +13 -1
@@ -23,6 +25,7 @@ test -r /etc/default/nfsd && . /etc/default/nfsd
 test -x "$NFS_MOUNTD" || NFS_MOUNTD=/usr/sbin/rpc.mountd
 test -x "$NFS_NFSD" || NFS_NFSD=/usr/sbin/rpc.nfsd
 test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
+test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid
 #
 # The user mode program must also exist (it just starts the kernel
 # threads using the kernel module code).
@@ -75,6 +78,17 @@ stop_mountd(){
 #
 #nfsd
 start_nfsd(){
+        modprobe -q nfsd
+	grep -q nfsd /proc/filesystems || {
+		echo NFS daemon support not enabled in kernel
+		exit 1
+        }
+	grep -q nfsd /proc/mounts || mount -t nfsd nfsd /proc/fs/nfsd
+	grep -q nfsd /proc/mounts || {
+		echo nfsd filesystem could not be mounted at /proc/fs/nfsd
+		exit 1
+        }
+
 	echo -n "starting $1 nfsd kernel threads: "
 	start-stop-daemon --start --exec "$NFS_NFSD" -- "$@"
 	echo done
@@ -113,14 +127,14 @@ stop_nfsd(){
 #statd
 start_statd(){
 	echo -n "starting statd: "
-	start-stop-daemon --start --exec "$NFS_STATD"
+	start-stop-daemon --start --exec "$NFS_STATD" --pidfile "$STATD_PID"
 	echo done

meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver stop_nfsd(){ · line 140

Quoted 10 lines
meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver +1 -1
 }
 stop_statd(){
 	# WARNING: this kills any process with the executable
 	# name 'statd'.
 	echo -n 'stopping statd: '
-	start-stop-daemon --stop --quiet --signal 1 --name statd
+	start-stop-daemon --stop --quiet --signal 1 --pidfile "$STATD_PID"
 	echo done
 }
 #----------------------------------------------------------------------

This stuff doesn't seem to e directly related to the "status" command.

p.

#7 lore raw

PATCH 4/6 openssh: add init.d/sshd status command for LSB compliance

In reply to [email protected]

From: Jackie Huang <[email protected]>

---
 .../openssh/openssh-6.2p2/init                     |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
meta/recipes-connectivity/openssh/openssh-6.2p2/init +14 -1
index 6beec84..6bbc573 100644
@@ -1,6 +1,9 @@
 #! /bin/sh
 set -e
 
+# source function library
+. /etc/init.d/functions
+
 # /etc/init.d/ssh: start and stop the OpenBSD "secure shell" daemon
 
 test -x /usr/sbin/sshd || exit 0
@@ -46,6 +49,11 @@ check_keys() {
 	fi
 }
 
+rh_status() {
+	status /usr/sbin/sshd;
+	return $?
+}
+
 export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
 
 case "$1" in
@@ -84,8 +92,13 @@ case "$1" in
 	echo "."
 	;;
 
+  status)
+	rh_status;
+	exit $?
+  ;;
+
   *)
-	echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}"
+	echo "Usage: /etc/init.d/ssh {start|stop|status|reload|force-reload|restart}"
 	exit 1
 esac
 
Signature · 1 line
1.7.4.1
#8 lore raw

Re: [PATCH 4/6] openssh: add init.d/sshd status command for LSB compliance

Hi Jackie

One thing comes to mind is that these scripts are hardcoding the binaries and may be it would be nicer to replace the bindir, libdir and so on at install time, that would make them flexible where /usr is not used e.g. but I guess thats a general problem with capture init scripts all around probably.

Quoted 56 lines · On Aug 19, 2013, at 8:25 PM, [email protected] wrote:

From: Jackie Huang <[email protected]>

---
.../openssh/openssh-6.2p2/init | 15 ++++++++++++++-

1 files changed, 14 insertions(+), 1 deletions(-)
meta/recipes-connectivity/openssh/openssh-6.2p2/init +0 -0
index 6beec84..6bbc573 100644
@@ -1,6 +1,9 @@
 #! /bin/sh

set -e

meta/recipes-connectivity/openssh/openssh-6.2p2/init +3 -0
+# source function library
+. /etc/init.d/functions
+

# /etc/init.d/ssh: start and stop the OpenBSD "secure shell" daemon

test -x /usr/sbin/sshd || exit 0

meta/recipes-connectivity/openssh/openssh-6.2p2/init +5 -0
@@ -46,6 +49,11 @@ check_keys() {
 	fi
 }
 
+rh_status() {
+	status /usr/sbin/sshd;
+	return $?
+}
+

export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

case "$1" in

meta/recipes-connectivity/openssh/openssh-6.2p2/init +6 -1
@@ -84,8 +92,13 @@ case "$1" in
 	echo "."
 	;;
 
+  status)
+	rh_status;
+	exit $?
+  ;;
+
  *)
-	echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}"
+	echo "Usage: /etc/init.d/ssh {start|stop|status|reload|force-reload|restart}"
 	exit 1

esac

Signature · 6 lines
1.7.4.1

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
author
#9 lore raw

Re: [PATCH 4/6] openssh: add init.d/sshd status command for LSB compliance

Quoted 5 lines · Khem Raj

Hi Jackie

One thing comes to mind is that these scripts are hardcoding the binaries and may be it would be nicer to replace the bindir, libdir and so on at install time, that would make them flexible where /usr is not used e.g. but I guess thats a general problem with capture init scripts all around probably.

Yes it is general problem that almost all init scripts have these hardcoding binaries, maybe we need a requirement and do that for all these scripts with a plan.

Thanks,
Jackie

Quoted 62 lines · On Aug 19, 2013, at 8:25 PM, [email protected] wrote:
Quoted 57 lines

From: Jackie Huang <[email protected]>

---
.../openssh/openssh-6.2p2/init | 15 ++++++++++++++-

1 files changed, 14 insertions(+), 1 deletions(-)
meta/recipes-connectivity/openssh/openssh-6.2p2/init +0 -0
index 6beec84..6bbc573 100644
@@ -1,6 +1,9 @@
 #! /bin/sh

set -e

meta/recipes-connectivity/openssh/openssh-6.2p2/init +3 -0
+# source function library
+. /etc/init.d/functions
+

# /etc/init.d/ssh: start and stop the OpenBSD "secure shell" daemon

test -x /usr/sbin/sshd || exit 0

meta/recipes-connectivity/openssh/openssh-6.2p2/init +5 -0
@@ -46,6 +49,11 @@ check_keys() {
 	fi
 }
 
+rh_status() {
+	status /usr/sbin/sshd;
+	return $?
+}
+

export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

case "$1" in

meta/recipes-connectivity/openssh/openssh-6.2p2/init +6 -1
@@ -84,8 +92,13 @@ case "$1" in
 	echo "."
 	;;
 
+  status)
+	rh_status;
+	exit $?
+  ;;
+
   *)
-	echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}"
+	echo "Usage: /etc/init.d/ssh {start|stop|status|reload|force-reload|restart}"
 	exit 1

esac

--
1.7.4.1

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 5 lines
Jackie Huang
WIND RIVER | China Development Center
MSN:[email protected]
Tel: +86 8477 8594
Mobile: +86 138 1027 4745
#10 lore raw

Re: [PATCH 4/6] openssh: add init.d/sshd status command for LSB compliance

Quoted 5 lines · On 08/22/2013 03:02 PM, jhuang0 wrote:
Quoted 2 lines · Khem Raj

Hi Jackie

Quoted 9 lines
Quoted 3 lines

One thing comes to mind is that these scripts are hardcoding the binaries and may be it would be nicer to replace the bindir, libdir and so on at install time, that would make them flexible where /usr is not used e.g. but I guess thats a general problem with capture init scripts all around probably.

Yes it is general problem that almost all init scripts have these hardcoding binaries, maybe we need a requirement and do that for all these scripts with a plan.

Thanks,
Jackie

Agree.

If we're going to do this, we need to take the postinst scripts into consideration, as the postinst scripts have the same problem.

Best Regards,
Chen Qi

Quoted 66 lines
Quoted 65 lines · On Aug 19, 2013, at 8:25 PM, [email protected] wrote:
Quoted 60 lines

From: Jackie Huang <[email protected]>

---
.../openssh/openssh-6.2p2/init | 15
++++++++++++++-

1 files changed, 14 insertions(+), 1 deletions(-)
meta/recipes-connectivity/openssh/openssh-6.2p2/init +0 -0
index 6beec84..6bbc573 100644
@@ -1,6 +1,9 @@
 #! /bin/sh

set -e

meta/recipes-connectivity/openssh/openssh-6.2p2/init +3 -0
+# source function library
+. /etc/init.d/functions
+

# /etc/init.d/ssh: start and stop the OpenBSD "secure shell" daemon

test -x /usr/sbin/sshd || exit 0

meta/recipes-connectivity/openssh/openssh-6.2p2/init +5 -0
@@ -46,6 +49,11 @@ check_keys() {
    fi
 }
 
+rh_status() {
+    status /usr/sbin/sshd;
+    return $?
+}
+

export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

case "$1" in

meta/recipes-connectivity/openssh/openssh-6.2p2/init +5 -1
@@ -84,8 +92,13 @@ case "$1" in
    echo "."
    ;;
 
+  status)
+    rh_status;
+    exit $?
+  ;;
+
   *)
-    echo "Usage: /etc/init.d/ssh 

{start|stop|reload|force-reload|restart}"
+ echo "Usage: /etc/init.d/ssh
{start|stop|status|reload|force-reload|restart}"
exit 1
esac

Signature · 6 lines
1.7.4.1

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
#11 lore raw

PATCH 5/6 sysklogd: add init.d/syslog status command for LSB compliance

In reply to [email protected]

From: Jackie Huang <[email protected]>

---
 meta/recipes-extended/sysklogd/files/sysklogd |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
meta/recipes-extended/sysklogd/files/sysklogd +12 -1
index dcbc81e..c966725 100755
@@ -12,6 +12,9 @@
 # Short-Description:    System logger
 ### END INIT INFO
 
+# Source function library.
+. /etc/init.d/functions
+
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 
 pidfile_syslogd=/var/run/syslogd.pid
@@ -132,8 +135,16 @@ case "$1" in
 	$0 start
     fi
     ;;
+  status)
+    status syslogd;
+    RETVAL=$?
+    status klogd;
+    rval=$?
+    [ $RETVAL -eq 0 ] && exit $rval
+    exit $RETVAL
+    ;;
   *)
-    log_success_msg "Usage: /etc/init.d/sysklogd {start|stop|reload|restart|force-reload|reload-or-restart}"
+    log_success_msg "Usage: /etc/init.d/sysklogd {start|stop|reload|restart|force-reload|reload-or-restart|status}"
     exit 1
 esac
 
Signature · 1 line
1.7.4.1
#12 lore raw

PATCH 6/6 at: add init.d/atd status command for LSB compliance

In reply to [email protected]

From: Jackie Huang <[email protected]>

---
 meta/recipes-extended/at/files/S99at |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
meta/recipes-extended/at/files/S99at +12 -1
index 386f8a4..d2ba34b 100644
@@ -5,6 +5,9 @@
 
 umask 077
 
+# Source function library.
+. /etc/init.d/functions
+
 start() {
 	echo -n "Starting atd: "
 	start-stop-daemon --start --quiet --pidfile /var/run/atd.pid --background --exec /usr/sbin/atd -- -f
@@ -20,6 +23,11 @@ restart() {
 	start
 }
 
+rh_status() {
+    # run checks to determine if the service is running or use generic status
+    status /usr/sbin/atd
+}
+
 case "$1" in
   start)
 	start
@@ -30,8 +38,11 @@ case "$1" in
   restart|reload)
 	restart
 	;;
+  status)
+	rh_status
+	;;
   *)
-	echo $"Usage: $0 {start|stop|restart}"
+	echo $"Usage: $0 {start|stop|restart|status}"
 	exit 1
 esac
 
Signature · 1 line
1.7.4.1