2
################################################################################
4
# Intel Data Center Bridging (DCB) Software
5
# Copyright(c) 2007-2008 Intel Corporation.
8
# Template LSB system startup script for example service/daemon FOO
9
# Copyright (C) 1995--2005 Kurt Garloff, SUSE / Novell Inc.
11
# This program is free software; you can redistribute it and/or modify it
12
# under the terms and conditions of the GNU General Public License,
13
# version 2, as published by the Free Software Foundation.
15
# This program is distributed in the hope it will be useful, but WITHOUT
16
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
20
# You should have received a copy of the GNU General Public License along with
21
# this program; if not, write to the Free Software Foundation, Inc.,
22
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
24
# The full GNU General Public License is included in this distribution in
25
# the file called "COPYING".
27
# Contact Information:
28
# e1000-eedc Mailing List <e1000-eedc@lists.sourceforge.net>
29
# Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
31
################################################################################
33
# dcbd This shell script takes care of starting and stopping
34
# dcbd (DCB capabilities exchange protocol)
36
# chkconfig: 345 20 80
37
# description: Data Center Bridging Exchange protocol daemon
41
# Required-Start: network
45
# Description: Data Center Bridging Exchange protocol daemon
49
DCBD_BIN=/usr/sbin/$DCBD
51
test -x $DCBD_BIN || { echo "$DCBD_BIN not installed";
52
if [ "$1" = "stop" ]; then exit 0;
55
# Default: Assume sysvinit binaries exist
56
start_daemon() { /sbin/start_daemon ${1+"$@"}; }
57
killproc() { /sbin/killproc ${1+"$@"}; }
58
pidofproc() { /sbin/pidofproc ${1+"$@"}; }
59
checkproc() { /sbin/checkproc ${1+"$@"}; }
61
if test -e /etc/rc.status; then
62
# SUSE rc script library
68
if test "${_cmd}" = "status"; then
69
_SMSG=(running dead dead unused unknown reserved)
72
_SMSG=(done failed failed missed failed skipped unused failed \
76
if test -e /lib/lsb/init-functions; then
78
. /lib/lsb/init-functions
81
if test ${_RC_RV} = 0; then
82
log_success_msg " [${_SMSG[${_RC_RV}]}] "
84
log_failure_msg " [${_SMSG[${_RC_RV}]}] "
87
# TODO: Add checking for lockfiles
88
checkproc() { pidofproc ${1+"$@"} >/dev/null 2>&1; }
89
elif test -e /etc/init.d/functions; then
91
. /etc/init.d/functions
94
#echo -n " [${_SMSG[${_RC_RV}]}] "
95
if test ${_RC_RV} = 0; then
96
success " [${_SMSG[${_RC_RV}]}] "
98
failure " [${_SMSG[${_RC_RV}]}] "
101
checkproc() { status ${1+"$@"}; return $?; }
102
start_daemon() { daemon ${1+"$@"}; return $?; }
105
echo_rc() { echo " [${_SMSG[${_RC_RV}]}] "; }
108
rc_reset() { _RC_RV=0; }
111
if test -z "$1"; then
113
elif test "$1" != "0"; then
125
if test "$1" = "-r"; then _RC_RV=0; shift; fi
126
if test "$1" = "-s"; then
127
rc_failed 5; echo_rc; rc_failed 3; shift;
129
if test "$1" = "-u"; then
130
rc_failed ${_RC_UNUSED}; echo_rc; rc_failed 3; shift;
132
if test "$1" = "-v"; then echo_rc; shift; fi
133
if test "$1" = "-r"; then _RC_RV=0; shift; fi
136
rc_exit() { exit ${_RC_RV}; }
139
if test -z "$RUNLEVEL"; then
140
read RUNLEVEL REST < <(/sbin/runlevel);
142
if test -e /etc/init.d/S[0-9][0-9]${1}; then return 0; fi
147
# Reset status of this service
150
# See how we were called.
153
if ! /sbin/lsmod | grep dcbnl > /dev/null; then
154
mod_dir="/lib/modules/$(uname -r)/kernel/net/dcb"
155
if [ -f $mod_dir/dcbnl.ko ]; then
156
modprobe dcbnl > /dev/null 2>&1
159
echo -n $"Starting $DCBD: "
160
start_daemon $DCBD_BIN -d $OPTIONS
162
[ $? -eq 0 ] && touch /var/lock/subsys/dcbd
165
echo -n $"Shutting down $DCBD: "
168
[ $? -eq 0 ] && rm -f /var/lock/subsys/dcbd
171
echo -n "Checking for service $DCBD: "
172
## Check status with checkproc(8), if process is running
173
## checkproc will return with exit status 0.
175
# Return value is slightly different for the status command:
176
# 0 - service up and running
177
# 1 - service dead, but /var/run/ pid file exists
178
# 2 - service dead, but /var/lock/ lock file exists
179
# 3 - service not running (unused)
180
# 4 - service status unknown :-(
181
# 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
183
# NOTE: checkproc returns LSB compliant status values.
185
# NOTE: rc_status knows that we called this init script with
186
# "status" option and adapts its messages accordingly.
189
try-restart|condrestart)
190
## Do a restart only if the service was active before.
191
## Note: try-restart is now part of LSB (as of 1.9).
192
## RH has a similar command named condrestart.
193
if test "$1" = "condrestart"; then
194
echo "${attn} Use try-restart ${done}(LSB)${attn}"\
195
"rather than condrestart ${warn}(RH)${norm}"
201
rc_reset # Not running is not a failure.
203
# Remember status and be quiet
210
# Remember status and be quiet
214
## Signal the daemon to reload its config. Most daemons
215
## do this on signal 1 (SIGHUP).
216
## If it does not support it, restart the service if it
219
#echo -n "Reload service $DCBD "
220
## if it supports it:
222
#touch /var/run/$DCBD.pid
230
## Like force-reload, but if daemon does not support
231
## signaling, do nothing (!)
233
# If it supports signaling:
234
#echo -n "Reload service $DCBD "
235
#killproc -HUP $DCBD_BIN
236
#touch /var/run/$DCBD.pid
239
## Otherwise if it does not support reload:
240
echo -n $"Reloading $DCBD is not supported: "
245
echo $"Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"