initscripts: Add status function to /etc/init.d/functions

[ CQID: WIND00388860 ]

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

(From OE-Core rev: adcb39845b6d3af9472fa5051a1d918344eb6bda)

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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Jesse Zhang 2013-01-26 17:18:54 +08:00 committed by Richard Purdie
parent 9a7b076176
commit 2e913bc62a
2 changed files with 16 additions and 1 deletions

View 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
}

View 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"