NetBSD/etc/rc.d/iscsid

38 lines
600 B
Bash
Executable File

#!/bin/sh
#
# $NetBSD: iscsid,v 1.3 2020/09/08 12:52:18 martin Exp $
#
# PROVIDE: iscsid
# REQUIRE: NETWORKING CRITLOCALMOUNTED
# BEFORE: securelevel mountcritremote
$_rc_subr_loaded . /etc/rc.subr
name="iscsid"
rcvar=$name
command="/sbin/${name}"
pidfile="/var/run/${name}.pid"
start_precmd="iscsid_precmd"
find_module()
{
local module rest
/sbin/modstat $1 | while read module rest; do
if [ "$module" = "$1" ]; then
echo found
break
fi
done
}
iscsid_precmd()
{
if [ "$(find_module iscsi)" != "found" ]; then
/sbin/modload iscsi
fi
}
load_rc_config $name
run_rc_command "$1"