3
# Copyright(c) 2009 Intel Corporation. All rights reserved.
5
# This program is free software; you can redistribute it and/or modify it
6
# under the terms and conditions of the GNU General Public License,
7
# version 2, as published by the Free Software Foundation.
9
# This program is distributed in the hope it will be useful, but WITHOUT
10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14
# You should have received a copy of the GNU General Public License along with
15
# this program; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
# Maintained at www.Open-FCoE.org
21
# chkconfig: 2345 92 19
22
# description: OpenFC and FCoE: Fibre Channel over Ethernet SAN setup
24
PATH=/sbin:/bin:/usr/sbin:/usr/bin
28
FCOE_CONF=/etc/fcoe/open-fcoe.conf
30
# validates the ifname
33
if [ ! -e $FCOE_CONF ]
35
echo "Open-fcoe config file $FCOE_CONF not found!"
39
HBA=`grep -v "#" $FCOE_CONF | grep "HBA=" | cut -f2 -d=`
40
if ! ifconfig $HBA &> /dev/null
42
echo "HBA $HBA not found in $FCOE_CONF!"
47
which $FCOEADM > /dev/null 2>&1
50
echo "$0: $FCOEADM command not installed" >&2
54
# Switch on start / stop argument
59
lsmod | grep fcoe &> /dev/null
62
modprobe -q fcoe 2> /dev/null
65
echo "Failed to load FCoE driver module!"
73
echo "Please setup the config file $FCOE_CONF first!"
76
$FCOEADM --create $HBA >&2
81
lsmod | grep fcoe &> /dev/null
84
echo "Open-FCoE driver module not loaded!"
90
$FCOEADM --destroy $HBA >&2
95
lsmod | grep fcoe &> /dev/null
98
echo "Open-FCoE driver module not loaded!"
102
$FCOEADM --query $HBA >&2
114
echo "Usage: $0 {start|stop|reload|restart|status}" >&2