diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr index fb3e5c19894..4b2b4ab05c4 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -1042,12 +1042,12 @@ run_rc_command() if [ -n "$_env" ]; then eval "export -- $_env" fi - _run_rc_precmd || return 1 # service can redefine all so check for valid targets if [ "$rc_arg" = 'start' -o "$rc_arg" = 'restart' -o \ "$rc_arg" = 'reload' ]; then _run_rc_setup || warn "failed to setup ${name}" fi + _run_rc_precmd || return 1 _run_rc_doit "$_cmd $rc_extra_args" || return 1 _run_rc_postcmd return $_return @@ -1107,13 +1107,15 @@ run_rc_command() return 1 fi + _run_rc_setup || warn "failed to setup ${name}" + if ! _run_rc_precmd; then warn "failed precmd routine for ${name}" return 1 fi - # setup the full command to run - # + # setup the full command to run + # check_startmsgs && echo "Starting ${name}." if [ -n "$_chroot" ]; then _cd= @@ -1143,8 +1145,6 @@ $command $rc_flags $command_args" fi fi - _run_rc_setup || warn "failed to setup ${name}" - # Prepend default limits _doit="$_cd limits -C $_login_class $_limits $_doit" @@ -1188,10 +1188,10 @@ $command $rc_flags $command_args" return 1 fi - _run_rc_precmd || return 1 - _run_rc_setup || warn "failed to setup ${name}" + _run_rc_precmd || return 1 + _doit=$(_run_rc_killcmd "${sig_reload:-HUP}") _run_rc_doit "$_doit" || return 1