freebsd-skq/etc/rc.d/devd
dougb d05cc95927 Introduce to rc.subr get_pidfile_from_conf(). It does just what it sounds
like, determines the path to a pid file as it is specified in a conf file.

Use the new feature for rc.d/named and rc.d/devd, the 2 services in the
base that list their pid files in their conf files.

Remove the now-obsolete named_pidfile, and warn users if they have it set.
2011-04-23 04:26:31 +00:00

41 lines
627 B
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: devd
# REQUIRE: netif
# BEFORE: NETWORKING mountcritremote
# KEYWORD: nojail shutdown
. /etc/rc.subr
name="devd"
rcvar=`set_rcvar`
command="/sbin/${name}"
start_precmd=${name}_prestart
stop_precmd=find_pidfile
find_pidfile()
{
if get_pidfile_from_conf pid-file /etc/devd.conf; then
pidfile="$_pidfile_from_conf"
else
pidfile="/var/run/${name}.pid"
fi
}
devd_prestart ()
{
find_pidfile
# If devd is disabled, turn it off in the kernel to avoid memory leaks.
if ! checkyesno ${rcvar}; then
$SYSCTL hw.bus.devctl_disable=1
fi
}
load_rc_config $name
run_rc_command "$1"