Drop restart_pre/restart_post

By design, restart is hard coded to run stop followed by start along
with all of the pre/post functions associated with them. Restart doesn't
need its own pre/post functions since it is possible to make any
function in an init script behave differently for a restart command by
testing against the RC_CMD environment variable.
This commit is contained in:
William Hubbs 2012-09-24 13:53:53 -05:00
parent f007988fba
commit 5615fa78d6
2 changed files with 0 additions and 27 deletions

View File

@ -447,11 +447,6 @@ depend()
need ${_need} need ${_need}
} }
restart_pre() {
# Verify a config and abort the restart in case it's not valid
...
}
# This function does any pre-start setup. If it fails, the service will # This function does any pre-start setup. If it fails, the service will
# not be started. # not be started.
# If you need this function to behave differently for a restart command, # If you need this function to behave differently for a restart command,

View File

@ -285,37 +285,15 @@ while [ -n "$1" ]; do
case $1 in case $1 in
start|stop|status) verify_boot;; start|stop|status) verify_boot;;
esac esac
# FIXME: We may want to skip the start/stop _pre functions later
# restart_pre
if [ "${RC_CMD}" = "restart" ]; then
if [ "${1}" = "stop" -a "$(command -v "restart_pre")" = "restart_pre" ]; then
restart_pre || exit $?
fi
fi
# Execute _pre functions
if [ "$(command -v "$1_pre")" = "$1_pre" ] if [ "$(command -v "$1_pre")" = "$1_pre" ]
then then
"$1"_pre || exit $? "$1"_pre || exit $?
fi fi
# Execute the actual command/function, start, stop, ...
"$1" || exit $? "$1" || exit $?
# restart_post
if [ "${RC_CMD}" = "restart" ]; then
if [ "${1}" = "start" -a "$(command -v "restart_post")" = "restart_post" ]; then
restart_post || exit $?
fi
fi
# Execute the _post functions
if [ "$(command -v "$1_post")" = "$1_post" ] if [ "$(command -v "$1_post")" = "$1_post" ]
then then
"$1"_post || exit $? "$1"_post || exit $?
fi fi
shift shift
continue 2 continue 2
else else