NetBSD/etc/rc.d/iscsid

38 lines
597 B
Bash
Executable File

#!/bin/sh
#
# $NetBSD: iscsid,v 1.1 2015/02/21 23:13:00 joerg Exp $
#
# PROVIDE: iscsid
# REQUIRE: NETWORKING mountcritlocal
# 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"