xref: /netbsd-src/etc/rc.d/iscsid (revision 0a9098d00fea89c48d26e8ec45087bd0ec34e0c8)
1#!/bin/sh
2#
3# $NetBSD: iscsid,v 1.3 2020/09/08 12:52:18 martin Exp $
4#
5
6# PROVIDE: iscsid
7# REQUIRE: NETWORKING CRITLOCALMOUNTED
8# BEFORE:  securelevel mountcritremote
9
10$_rc_subr_loaded . /etc/rc.subr
11
12name="iscsid"
13rcvar=$name
14command="/sbin/${name}"
15pidfile="/var/run/${name}.pid"
16start_precmd="iscsid_precmd"
17
18find_module()
19{
20	local module rest
21	/sbin/modstat $1 | while read module rest; do
22		if [ "$module" = "$1" ]; then
23			echo found
24			break
25		fi
26	done
27}
28
29iscsid_precmd()
30{
31	if [ "$(find_module iscsi)" != "found" ]; then
32		/sbin/modload iscsi
33	fi
34}
35
36load_rc_config $name
37run_rc_command "$1"
38