Files
ports/sysutils/runit/files/runsvdir.in
T
Chris Rees a3a0138c36 sysutils/runit: Fix shutdown and reboot
The FreeBSD PREFIX insistence plays havoc with runit, but this
should fix the issues on rebooting and shutting down when using
runit-init.

The problem was because of the inconsistency of where stopit and
reboot are stored.

While here, pet rclint and identify bug in rclint at the same time!
2023-09-17 07:50:43 +01:00

37 lines
782 B
Bash

#!/bin/sh
#
# PROVIDE: runsvdir
# BEFORE: SERVERS
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable `runsvdir':
#
# runsvdir_enable="YES" (default: NO)
# runsvdir_path="/var/service" (default: %%SERVICE_DIR%%)
. /etc/rc.subr
name=runsvdir
rcvar=runsvdir_enable
desc="Runit service supervision"
load_rc_config $name
: ${runsvdir_enable:=NO}
: ${runsvdir_path=%%SERVICE_DIR%%}
command="%%PREFIX%%/sbin/runsvdir"
start_cmd=runsvdir_start
stop_postcmd="%%PREFIX%%/sbin/sv exit ${runsvdir_path}/*"
runsvdir_start()
{
/bin/test -d ${runsvdir_path} || /bin/mkdir -p ${runsvdir_path}
/usr/bin/env -i \
PATH=/command:%%PREFIX%%/sbin:%%PREFIX%%/bin:/sbin:/bin:/usr/sbin:/usr/bin \
/usr/sbin/daemon -c -f \
${command} ${runsvdir_path}
}
run_rc_command $1