summaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-11-29 16:23:59 +0000
committerRoy Marples <roy@marples.name>2007-11-29 16:23:59 +0000
commit16ad975b2de79f0fa9ae27940598658247bd3c5e (patch)
tree0bff815da65564bcd98c8af95693f7b877ed57e5 /sh
parent82df7e4584282896a0618f14cca2dd3f3d23e8a2 (diff)
downloadopenrc-16ad975b2de79f0fa9ae27940598658247bd3c5e.tar.gz
openrc-16ad975b2de79f0fa9ae27940598658247bd3c5e.tar.bz2
openrc-16ad975b2de79f0fa9ae27940598658247bd3c5e.tar.xz
Allow services to define which extra commands require the service to be started
Diffstat (limited to 'sh')
-rwxr-xr-xsh/runscript.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/sh/runscript.sh b/sh/runscript.sh
index 44ebd81..641febc 100755
--- a/sh/runscript.sh
+++ b/sh/runscript.sh
@@ -144,7 +144,8 @@ fi
while [ -n "$1" ]; do
# See if we have the required function and run it
- for _cmd in describe start stop ${extra_commands:-${opts}}; do
+ for _cmd in describe start stop ${extra_commands:-${opts}} \
+ ${extra_started_commands}; do
if [ "${_cmd}" = "$1" ]; then
if type "$1" >/dev/null 2>&1; then
# If we're in the background, we may wish to fake some
@@ -159,6 +160,16 @@ while [ -n "$1" ]; do
fi
done
fi
+ # Check to see if we need to be started before we can run
+ # this command
+ for _cmd in ${extra_started_commands}; do
+ if [ "${_cmd}" = "$1" ]; then
+ if ! service_started "${SVCNAME}"; then
+ eerror "${SVCNAME}: cannot \`$1' as it has not been started"
+ exit 1
+ fi
+ fi
+ done
unset _cmd
if type "$1"_pre >/dev/null 2>&1; then
"$1"_pre || exit $?