]> code.ossystems Code Review - openembedded-core.git/commitdiff
initscripts: Add status function to /etc/init.d/functions
authorJesse Zhang <sen.zhang@windriver.com>
Sat, 26 Jan 2013 09:18:54 +0000 (17:18 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 8 Feb 2013 14:46:13 +0000 (14:46 +0000)
[ CQID: WIND00388860 ]

Many initscripts want a simple way to display status information.
Add the 'status' function to the functions file.

Signed-off-by: Jesse Zhang <sen.zhang@windriver.com>
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
meta/recipes-core/initscripts/initscripts-1.0/functions
meta/recipes-core/initscripts/initscripts_1.0.bb

index dd7da2b1c3f3d0377582f44ef2a5745b78e61708..944e3a59b05647e73fdd1bce319fff5e8f008b33 100644 (file)
@@ -42,3 +42,18 @@ machine_id() { # return the machine ID
 killproc() { # kill the named process(es)
        pid=`pidofproc $1` && kill $pid
 }
+
+status() {
+    local pid
+    if [ "$#" = 0 ]; then
+        echo "Usage: status {program}"
+        return 1
+    fi
+    pid=`pidofproc $1`
+    if [ -n "$pid" ]; then
+        echo "$1 (pid $pid) is running..."
+    else
+        echo "$1 is stopped"
+    fi
+    return 3
+}
index 68f80346ef794d913d2e76a4d6255156a9bfab4e..649e18269e004f5118f0cd7ae5a389b13b7cbe71 100644 (file)
@@ -3,7 +3,7 @@ DESCRIPTION = "Initscripts provide the basic system startup initialization scrip
 SECTION = "base"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
-PR = "r139"
+PR = "r140"
 
 INHIBIT_DEFAULT_DEPS = "1"