add support for __process --name (in theory)

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-03-27 23:29:10 +02:00
parent 40b7b158c0
commit b8002efa6d
4 changed files with 21 additions and 4 deletions

View file

@ -21,6 +21,10 @@
# Check whether a process runs
#
process="$__object_id"
if [ -f "$__object/parameter/name" ]; then
name="$(cat "$__object/parameter/name")"
else
name="$__object_id"
fi
pgrep -x -f "$process" || true
pgrep -x -f "$name" || true

View file

@ -21,7 +21,11 @@
# __file is a very basic type, which will probably be reused quite often
#
process="$__object_id"
if [ -f "$__object/parameter/name" ]; then
name="$(cat "$__object/parameter/name")"
else
name="$__object_id"
fi
runs="$(cat "$__object/explorer/runs")"
state="$(cat "$__object/parameter/state")"
@ -33,7 +37,7 @@ case "$state" in
if [ -f "$__object/parameter/start" ]; then
cat "$__object/parameter/start"
else
echo "$process"
echo "$name"
fi
fi
;;
@ -47,4 +51,9 @@ case "$state" in
fi
fi
;;
*)
echo "Unknown state: $state" >&2
exit 1
;;
esac

View file

@ -21,6 +21,9 @@ state::
OPTIONAL PARAMETERS
-------------------
name::
Process name to match on when using pgrep -f -x.
stop::
Executable to use for stopping the process.

View file

@ -1,2 +1,3 @@
name
stop
start