Hi,
I got the OpenSuse 13.2 up and running and installed the package vblade on it. This package doesn’t como with a init script but I already have one working script on a Suse enterprise Linux 11 and tryed to use iT on the new OpenSuse.
I put the script at /etc/init.d/vblade and created a link “/usr/sbin/rcvblade -> /etc/init.d/vblade”, then used the chkconfig command to enable the init script, but it wont start, it only prints the following message and exits.
olimpo:~ # /etc/init.d/vblade start
redirecting to systemctl start vblade.service
olimpo:~ #
This is the script file I’m trying to run
#!/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)
#
# Script grabbed from http://cvs.fedoraproject.org/viewvc/EL-5/vblade/vblade.init?view=co
### BEGIN INIT INFO
# Provides: vbladed
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start the vbladed daemon
### END INIT INFO
#. /lib/lsb/init-functions
. /etc/rc.status
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
RETVAL=0
prog=vblade
# First reset status of this service
rc_reset
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 ] && rc_status -v || rc_failed 1
echo
}
start() {
echo $"Starting up $prog: "
if `grep -vc '^#\|^$' /etc/$prog.conf` != 0 ]
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?"
rc_failed 3
rc_status -v
echo
fi
}
startdisk() {
echo $"Starting up disk $1: "
if `grep -vc '^#\|^$' /etc/$prog.conf` != 0 ]
then
grep -w "$1" /etc/$prog.conf | grep -v "#" | grep -v grep | sed -e 's/ / /g' -e 's/ / /g' | while read line
do
DEVICE=`echo $line | awk -F" " '{print $4}'`
if -b $DEVICE ]];then
spawn_vblade $line
else
echo
echo -n "No such device $DEVICE"
#failure
rc_failed 1
rc_status -v
echo
echo
fi
done
touch /var/lock/subsys/$prog
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
rc_status -v
echo
rm -f /var/lock/subsys/$prog
}
stopdisk() {
echo -n $"Shutting down disk $1: "
grep "$1" /etc/$prog.conf | grep -v "#" | grep -v grep | sed -e 's/ / /g' -e 's/ / /g' | while read line
do
ID=`echo $line | awk -F" " '{print $1"-e"$2"."$3}'`
pidfile=/var/run/$prog/${ID}.pid
kill -9 `cat $pidfile`
rm -f $pidfile
done
#success
rc_status -v
echo
rm -f /var/lock/subsys/$prog
}
case "$1" in
start)
start
;;
startdisk)
startdisk $2
;;
stop)
stop
;;
stopdisk)
stopdisk $2
;;
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|startdisk|stop|stopdisk|restart|reload|condrestart|status}"
RETVAL=1
esac
exit $RETVAL
and tis is a sample of the config file
# network_device shelf slot file||disk_partition mac,mac,mac]]
#=================================================================================
#
em1 3 0 /dev/sdb1
The script should read some lines from its config file (/etc/vblade.conf) and spawn the vblade process for each configured disk, but I found out that when it goes to source the file /etc/rc_status it doesn’t come back and gives the message repported above.
I tryed to spawn the process by hand for one disk and it worked.
olimpo:~ # vblade 3 0 em1 /dev/sdb1
pid 3629: e3.0, 1952446464 sectors O_RDWR
Am I missing something? What should I do to get it working?
Best Regards,
Carlos