-# $OpenBSD: rc.subr,v 1.154 2022/05/26 11:27:03 ajacoutot Exp $
+# $OpenBSD: rc.subr,v 1.155 2022/08/29 19:14:02 ajacoutot Exp $
#
# Copyright (c) 2010, 2011, 2014-2022 Antoine Jacoutot <ajacoutot@openbsd.org>
# Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
return
}
+rc_configtest() {
+ return 0
+}
+
rc_exec() {
local _rcexec="su -fl -c ${daemon_class} -s /bin/sh ${daemon_user} -c"
[ "${daemon_rtable}" -eq "$(id -R)" ] ||
[ -z "${INRC}" ] && _rc_do rc_check && exit 0
echo $_n "${INRC:+ }${_name}"
while true; do # no real loop, only needed to break
+ # mostly useful for daemons whose child will not return
+ # a config parsing error to the parent during startup
+ # e.g. bgpd, httpd...
+ _rc_do rc_configtest || break
if type rc_pre >/dev/null; then
_rc_do rc_pre || break
fi
reload)
echo $_n "${INRC:+ }${_name}"
_rc_do rc_check || _rc_exit failed
+ _rc_do rc_configtest || _rc_exit failed
_rc_do rc_reload & _timer=$!
while ((SECONDS < daemon_timeout)); do
pkill -0 -P "$$" 2>/dev/null || break
_rc_exit ${_exit:=ok}
;;
restart)
+ _rc_do rc_configtest || _rc_exit failed
$0 ${_RC_DEBUG} ${_RC_FORCE} stop &&
$0 ${_RC_DEBUG} ${_RC_FORCE} start
;;
-.\" $OpenBSD: rc.subr.8,v 1.45 2022/05/27 12:27:39 ajacoutot Exp $
+.\" $OpenBSD: rc.subr.8,v 1.46 2022/08/29 19:14:02 ajacoutot Exp $
.\"
-.\" Copyright (c) 2021 Antoine Jacoutot
+.\" Copyright (c) 2021, 2022 Antoine Jacoutot
.\" Copyright (c) 2011 Robert Nagy, Antoine Jacoutot, Ingo Schwarze
.\" All rights reserved.
.\"
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: May 27 2022 $
+.Dd $Mdocdate: August 29 2022 $
.Dt RC.SUBR 8
.Os
.Sh NAME
call
.Ic rc_reload .
.El
+.It Ic rc_configtest
+Check daemon configuration before running
+.Cm start ,
+.Cm reload
+and
+.Cm restart .
+Defaults to
+.Sq return 0
+but can be overriden by the
+.Xr rc.d 8
+script.
.It Ic rc_exec
Execute argument using
.Xr su 1
by the default
.Fn rc_reload
function.
-Default to
+Defaults to
.Em HUP .
.It Va rc_stop_signal
Signal sent to the daemon process