-# $OpenBSD: rc.subr,v 1.160 2022/10/19 21:04:45 ajacoutot Exp $
+# $OpenBSD: rc.subr,v 1.161 2023/12/15 16:59:48 jca Exp $
#
# Copyright (c) 2010, 2011, 2014-2022 Antoine Jacoutot <ajacoutot@openbsd.org>
# Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
[ "${daemon_rtable}" -eq "$(id -R)" ] ||
_rcexec="route -T ${daemon_rtable} exec ${_rcexec}"
- ${_rcexec} "${daemon_logger:+set -o pipefail; } \
+ local _set_monitor=":"
+ # Run non-daemons services in a different process group to avoid SIGHUP
+ # at boot.
+ if [ X"${rc_bg}" = X"YES" ]; then
+ _set_monitor="set -o monitor"
+ fi
+
+ ${_rcexec} "${_set_monitor}; \
+ ${daemon_logger:+set -o pipefail; } \
${daemon_execdir:+cd ${daemon_execdir} && } \
$@ \
${daemon_logger:+ 2>&1 |