aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiloslav Trmac <mitr@volny.cz>2006-01-27 15:55:06 +0000
committerMiloslav Trmac <mitr@volny.cz>2006-01-27 15:55:06 +0000
commitf566bcc31b7b3be98a6b148e9dfa9f6d86741beb (patch)
tree691aa1474c445d28a41573f717a76d2054bab5f4
parent6667791881685c35ffeabcf45502134561919fae (diff)
downloadinitscripts-f566bcc31b7b3be98a6b148e9dfa9f6d86741beb.tar
initscripts-f566bcc31b7b3be98a6b148e9dfa9f6d86741beb.tar.gz
initscripts-f566bcc31b7b3be98a6b148e9dfa9f6d86741beb.tar.bz2
initscripts-f566bcc31b7b3be98a6b148e9dfa9f6d86741beb.tar.xz
initscripts-f566bcc31b7b3be98a6b148e9dfa9f6d86741beb.zip
Add -p to status() (#134363)
-rwxr-xr-xrc.d/init.d/functions15
1 files changed, 10 insertions, 5 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 4b89cdad..7ba1090a 100755
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -298,14 +298,18 @@ pidofproc() {
}
status() {
- local base=${1##*/}
- local pid
+ local base pid pid_file=
# Test syntax.
if [ "$#" = 0 ] ; then
- echo $"Usage: status {program}"
+ echo $"Usage: status [-p pidfile] {program}"
return 1
fi
+ if [ "$1" = "-p" ]; then
+ pid_file=$2
+ shift 2
+ fi
+ base=${1##*/}
# First try "pidof"
pid="$(__pids_pidof "$1")"
@@ -315,8 +319,9 @@ status() {
fi
# Next try "/var/run/*.pid" files
- if [ -f /var/run/${base}.pid ] ; then
- read pid < /var/run/${base}.pid
+ [ -z "$pid_file" ] && pid_file=/var/run/${base}.pid
+ if [ -f "$pid_file" ] ; then
+ read pid < "$pid_file"
if [ -n "$pid" ]; then
echo $"${base} dead but pid file exists"
return 1