Avoid invoking the current script again when we need

to issue sub-commands, e.g., restart = stop + start.
By calling run_rc_command instead, we provide rc.d
scripts with full control over their configuration
variables.

For an example problem the former approach caused, see
http://lists.freebsd.org/pipermail/freebsd-rc/2005-October/000311.html

Reviewed by:	freebsd-rc
Tested by:	Dirk Engling erdgeist <at> erdgeist.org
MFC after:	2 weeks
This commit is contained in:
Yaroslav Tykhiy 2005-11-16 10:45:19 +00:00
parent b77640621b
commit fd9791c1ea
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152519

View File

@ -770,8 +770,9 @@ $command $rc_flags $command_args"
fi
_rc_restart_done=true
( $0 ${_rc_prefix}stop $rc_extra_args )
$0 ${_rc_prefix}start $rc_extra_args
# run stop in a subshell to keep variables for start
( run_rc_command ${_rc_prefix}stop $rc_extra_args )
run_rc_command ${_rc_prefix}start $rc_extra_args
if [ -n "$_postcmd" ]; then
eval $_postcmd $rc_extra_args