Patchwork [meta-oe,v2,2/3] collectd: fix init status

login
register
mail settings
Submitter jackie huang
Date April 8, 2014, 9:07 a.m.
Message ID <142cb3ea9de9dde15abb3e9a8a7ccd8ba5f07e6b.1396947706.git.jackie.huang@windriver.com>
Download mbox | patch
Permalink /patch/70259/
State Accepted, archived
Headers show

Comments

jackie huang - April 8, 2014, 9:07 a.m.
From: Wenzong Fan <wenzong.fan@windriver.com>

Fix init status to get it works with 'service --status-all'.

Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
 .../collectd/collectd/collectd.init                |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Patch

diff --git a/meta-oe/recipes-extended/collectd/collectd/collectd.init b/meta-oe/recipes-extended/collectd/collectd/collectd.init
index abdb194..95f5f73 100644
--- a/meta-oe/recipes-extended/collectd/collectd/collectd.init
+++ b/meta-oe/recipes-extended/collectd/collectd/collectd.init
@@ -146,6 +146,17 @@  d_stop() {
 	return "$rc"
 }
 
+# return:
+#   0 if the daemon is running
+#   3 if the daemon is stopped
+d_status(){
+	if test "$USE_COLLECTDMON" == 1; then
+		status $COLLECTDMON_DAEMON
+	else
+		status $DAEMON
+	fi
+}
+
 case "$1" in
 	start)
 		echo -n "Starting $NAME"
@@ -164,7 +175,7 @@  case "$1" in
 		esac
 		;;
 	status)
-		status_of_proc -p "$_PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
+		d_status
 		;;
 	restart|force-reload)
 		echo -n "Restarting $NAME"