Group :: System/Kernel and hardware
RPM: vblade
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
#!/bin/sh
#
# Init script for vblade (ATA over Ethernet daemon)
#
# chkconfig: - 30 70
# description: vblade AoE daemon
#
# processname: vblade
# config: /etc/vblade.conf
#
# Shamelessly hacked together from other init scripts (sshd, mostly)
#
# source function library
. /etc/rc.d/init.d/functions
RETVAL=0
prog=vblade
spawn_vblade() {
ALLOWMACS=""
[ -n "$5" ] && ALLOWMACS="-m $5"
ID="$1-e$2.$3"
PID_FILE=/var/run/$prog/${ID}.pid
$prog $ALLOWMACS $2 $3 $1 $4 >> /var/log/$prog.log 2>&1 &
pid=$!
RETVAL=$?
echo $pid > $PID_FILE
echo -n $"$4 (e$2.$3@$1) [pid $pid]"
[ "$RETVAL" = 0 ] && success || failure
echo
}
start() {
echo $"Starting up $prog: "
if [ `grep -vc '^#\|^$' /etc/$prog.conf` ]
then
grep -v '^#' /etc/$prog.conf | sed -e 's/ / /g' -e 's/ / /g' | while read line
do
spawn_vblade $line
done
touch /var/lock/subsys/$prog
else
echo -n "empty $prog.conf?"
passed
echo
fi
}
stop() {
echo -n $"Shutting down $prog: "
for pidfile in `ls /var/run/$prog/*.pid`
do
kill -9 `cat $pidfile`
rm -f $pidfile
done
success
echo
rm -f /var/lock/subsys/$prog
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
reload)
# yes, this sucks, but the vblade processes die on SIGHUP
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/$prog ]; then
stop
# avoid race
sleep 3
start
fi
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
RETVAL=1
esac
exit $RETVAL