aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2014-07-05 14:30:33 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2014-07-09 15:33:48 -0500
commit57b9e601a97fac3a044ec5d7e5f11b6219c892b7 (patch)
tree7de5782fca1be81622de814b9cb4d37df673b03b
parentc1de8c09bf4895c6108d297fcebd63046e49e614 (diff)
init.d/local: bring functioning more in line with how sysctl works
- remove the has_executables variable since it isn't used. - Convert the conditional calls to ewend/vewend to a single call to veend. - Always call eend after all scripts are executed passing the appropriate error code. Because of this change, you will see only an overall status when starting or stopping local unless you are using verbose mode.
-rw-r--r--init.d/local.in22
1 files changed, 6 insertions, 16 deletions
diff --git a/init.d/local.in b/init.d/local.in
index 06be25f2..180735de 100644
--- a/init.d/local.in
+++ b/init.d/local.in
@@ -14,20 +14,17 @@ start()
{
ebegin "Starting local"
- local file has_errors retval
+ local file has_errors=0 retval
eindent
for file in @SYSCONFDIR@/local.d/*.start; do
if [ -x "${file}" ]; then
- has_executables=1
vebegin "Executing \"${file}\""
"${file}" 2>&1 >/dev/null
retval=$?
if [ ${retval} -ne 0 ]; then
has_errors=1
- ewend ${retval} "Execution of \"${file}\" failed."
- else
- vewend 0
fi
+ veend ${retval} "Execution of \"${file}\" failed."
fi
done
eoutdent
@@ -40,9 +37,7 @@ start()
local_start
fi
- if [ -z "${has_errors}" ]; then
- eend 0
- fi
+ eend ${has_errors}
# We have to end with a zero exit code, because a failed execution
# of an executable @SYSCONFDIR@/local.d/*.start file shouldn't result in
@@ -57,20 +52,17 @@ stop()
{
ebegin "Stopping local"
- local file has_errors retval
+ local file has_errors=0 retval
eindent
for file in @SYSCONFDIR@/local.d/*.stop; do
if [ -x "${file}" ]; then
- has_executables=1
vebegin "Executing \"${file}\""
"${file}" 2>&1 >/dev/null
retval=$?
if [ ${retval} -ne 0 ]; then
has_errors=1
- ewend ${retval} "Execution of \"${file}\" failed."
- else
- vewend 0
fi
+ veend ${retval} "Execution of \"${file}\" failed."
fi
done
eoutdent
@@ -83,9 +75,7 @@ stop()
local_stop
fi
- if [ -z "${has_errors}" ]; then
- eend 0
- fi
+ eend ${has_errors}
# An executable @SYSCONFDIR@/local.d/*.stop file which failed with a
# non-zero exit status is not a reason to mark this service