summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2015-12-18 19:58:34 +0000
committerjilles <jilles@FreeBSD.org>2015-12-18 19:58:34 +0000
commit16bcef78d606fc3433a7f8411c8b0ff9c41b1b2c (patch)
tree8de81ad74716023fc5a45059a12077458c30f6b1 /etc
parenta5f1c95b3c8a3114c0dd550de01326f7c442020a (diff)
downloadFreeBSD-src-16bcef78d606fc3433a7f8411c8b0ff9c41b1b2c.zip
FreeBSD-src-16bcef78d606fc3433a7f8411c8b0ff9c41b1b2c.tar.gz
MFC r291770: rc.subr: Check for running daemons before a custom start_cmd
is executed. Currently rc scripts implementing their own start_cmd do not enjoy the benefits of rc.subr's own check for rc_pid. This leads to around a third of ports with such a start_cmd not to check for the process at all and two thirds of ports to re-implement this check (sometimes wrongly). This patch moves the check for rc_pid to before ${rc_arg}_cmd is executed. Submitted by: Dirk Engling Reviewed by: feld Relnotes: yes
Diffstat (limited to 'etc')
-rw-r--r--etc/rc.subr16
1 files changed, 8 insertions, 8 deletions
diff --git a/etc/rc.subr b/etc/rc.subr
index b908f1b..5048c52 100644
--- a/etc/rc.subr
+++ b/etc/rc.subr
@@ -974,6 +974,14 @@ run_rc_command()
fi
fi
+ if [ $rc_arg = "start" -a -z "$rc_fast" -a -n "$rc_pid" ]; then
+ if [ -z "$rc_quiet" ]; then
+ echo 1>&2 "${name} already running? " \
+ "(pid=$rc_pid)."
+ fi
+ return 1
+ fi
+
# if there's a custom ${XXX_cmd},
# run that instead of the default
#
@@ -1002,14 +1010,6 @@ run_rc_command()
;;
start)
- if [ -z "$rc_fast" -a -n "$rc_pid" ]; then
- if [ -z "$rc_quiet" ]; then
- echo 1>&2 "${name} already running? " \
- "(pid=$rc_pid)."
- fi
- return 1
- fi
-
if [ ! -x "${_chroot}${_chroot:+/}${command}" ]; then
warn "run_rc_command: cannot run $command"
return 1
OpenPOWER on IntegriCloud