Skip to contentSkip to conversation

Add status command for daemon of some packages

PATCH Superseded [email protected] 2 participants 11 messages Aug 21, 2013 – Aug 22, 2013

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add status command for daemon of some packages

From: Jackie Huang <[email protected]>

v2 comments:
remove stuff that doesn't related to "status" command

--
The following changes since commit d98f08a7ad95d0b17846276b028a6614f16b6846:

genext2fs: fix memory corruption on powerpc (2013-08-20 07:11:44 -0700)

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

Jackie Huang (6):
sysklogd: add init.d/syslog status command for LSB compliance
at: add init.d/atd status command for LSB compliance
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

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

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

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..258f882 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
#2 lore raw

PATCH v2 2/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
#3 lore raw

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

In reply to [email protected]

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
#4 lore raw

PATCH v2 4/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 |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
meta/recipes-core/sysvinit/sysvinit/bootlogd.init +8 -1
index f8f07a0..7b87827 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
@@ -73,10 +76,14 @@ case "$ACTION" in
 		start-stop-daemon --start --quiet --exec $DAEMON
 		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
#5 lore raw

PATCH v2 5/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                  |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver +9 -0
index e460e26..5b4f199 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
@@ -141,6 +143,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 5/6] nfs-utils: add init.d/nfsserver status command for LSB compliance

Quoted 26 lines · On 08/20/2013 11:15 PM, [email protected] wrote:

From: Jackie Huang <[email protected]>

---
  .../nfs-utils/nfs-utils/nfsserver                  |    9 +++++++++
  1 files changed, 9 insertions(+), 0 deletions(-)
meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver +2 -0
index e460e26..5b4f199 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
@@ -141,6 +143,13 @@ stop)	exportfs -ua
  	stop_statd
  	stop_mountd
  	stop_nfsd;;

meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver stop) exportfs -ua · line 155

Quoted 10 lines
meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver +7 -0
+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

Should there also be a usage update or addition?

Sau!

author
#7 lore raw

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

Quoted 31 lines · Saul Wold
Quoted 30 lines · On 08/20/2013 11:15 PM, [email protected] wrote:

From: Jackie Huang <[email protected]>

---
  .../nfs-utils/nfs-utils/nfsserver                  |    9 +++++++++
  1 files changed, 9 insertions(+), 0 deletions(-)
meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver +6 -0
index e460e26..5b4f199 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
@@ -141,6 +143,13 @@ stop)    exportfs -ua
      stop_statd
      stop_mountd
      stop_nfsd;;
+status)
+    status /usr/sbin/rpc.mountd
+    RETVAL=$?
+    status nfsd
Quoted 8 lines

meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver stop) exportfs -ua · line 155

Quoted 7 lines
meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver +3 -0
+    rval=$?
+    [ $RETVAL -eq 0 ] && exit $rval
+    exit $RETVAL;;
  reload)    test -r /etc/exports && exportfs -r;;
  restart)exportfs -ua
      stop_mountd

Should there also be a usage update or addition?

There was not a usage line existed, that's why the original patch didn't have a usage update, I will add it anyway.

Thanks,
Jackie

Quoted 4 lines

Sau!

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

PATCH v2 6/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                     |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
meta/recipes-connectivity/openssh/openssh-6.2p2/init +13 -1
index 12fb79b..72c5822 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
@@ -54,6 +57,11 @@ check_keys() {
 	fi
 }
 
+rh_status() {
+	status /usr/sbin/sshd
+	return $?
+}
+
 export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
 
 case "$1" in
@@ -92,8 +100,12 @@ case "$1" in
 	echo "."
 	;;
 
+  status)
+	rh_status
+  ;;
+
   *)
-	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
#9 lore raw

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

Quoted 35 lines · On 08/20/2013 11:15 PM, [email protected] wrote:

From: Jackie Huang <[email protected]>

---
  .../openssh/openssh-6.2p2/init                     |   14 +++++++++++++-
  1 files changed, 13 insertions(+), 1 deletions(-)
meta/recipes-connectivity/openssh/openssh-6.2p2/init +8 -0
index 12fb79b..72c5822 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
@@ -54,6 +57,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 case "$1" in · line 104

Quoted 5 lines
meta/recipes-connectivity/openssh/openssh-6.2p2/init +2 -0
@@ -92,8 +100,12 @@ case "$1" in
  	echo "."
  	;;
 
+  status)
+	rh_status

Why rh_status here and in the "at" script? Can't you just do the status /usr/bin/sshd directly here?

Quoted 9 lines
meta/recipes-connectivity/openssh/openssh-6.2p2/init +3 -1
+  ;;
+
    *)
-	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
 
author
#10 lore raw

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

Quoted 41 lines · Saul Wold
Quoted 40 lines · On 08/20/2013 11:15 PM, [email protected] wrote:

From: Jackie Huang <[email protected]>

---
  .../openssh/openssh-6.2p2/init                     |   14
+++++++++++++-
  1 files changed, 13 insertions(+), 1 deletions(-)
meta/recipes-connectivity/openssh/openssh-6.2p2/init +8 -0
index 12fb79b..72c5822 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
@@ -54,6 +57,11 @@ check_keys() {
      fi
  }
 
+rh_status() {
+    status /usr/sbin/sshd
+    return $?
+}
+
  export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
 
  case "$1" in
@@ -92,8 +100,12 @@ case "$1" in
      echo "."
      ;;
 
Quoted 5 lines

meta/recipes-connectivity/openssh/openssh-6.2p2/init case "$1" in · line 104

Quoted 2 lines
meta/recipes-connectivity/openssh/openssh-6.2p2/init +2 -0
+  status)
+    rh_status

Why rh_status here and in the "at" script? Can't you just do the status /usr/bin/sshd directly here?

We may found this from Red Hat/Fedora, sure we can do it directly here, I will change it if you think it would be better.

Thanks,
Jackie

Quoted 13 lines
Quoted 12 lines
meta/recipes-connectivity/openssh/openssh-6.2p2/init +2 -1
+  ;;
+
    *)
-    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 · 5 lines
Jackie Huang
WIND RIVER | China Development Center
MSN:[email protected]
Tel: +86 8477 8594
Mobile: +86 138 1027 4745