Please consider the following startup script for inclusion.
Attached is the one for Redhat/Fedora, already included in the
scsi-target-utils package,
but slightly modified (ie using the --op delete --mode system options
to stop it) and a
show option to show the configured targets.
Few things missing, a framework to start up with predefined target
setups, and the
chkconfig sequence numbers need to be fine tuned. The target should
start up before
open-iscsi and stop after it.
Albert
#!/bin/sh
#
# chkconfig: - 39 35
#
### BEGIN INIT INFO
# Provides: tgtd
# Required-Start: $network
# Short-Description: Starts and stops the generic storage target daemon
# Description: tgtd provides the SCSI and software transport target state
# machine daemon.
### END INIT INFO
#
#
# pidfile: /var/run/tgtd.pid
#
# Source function library.
. /etc/init.d/functions
PATH=/sbin:/bin:/usr/sbin:/usr/bin
RETVAL=0
start()
{
echo -n $"Starting SCSI target daemon: "
if [ -f /var/lock/subsys/tgtd ]; then
echo
success
return
fi
daemon tgtd
echo
RETVAL=$?
if [ $RETVAL -eq "0" ]; then
touch /var/lock/subsys/tgtd
fi
}
stop()
{
echo -n $"Stopping SCSI target daemon: "
if [ ! -f /var/lock/subsys/tgtd ]; then
echo
success
return
fi
TARGETS=`tgtadm --op show --mode target | grep "^Target" | cut -d':'
-f1 | cut -d' ' -f2`
for TID in $TARGETS
do
tgtadm --op delete -m target -t $TID
done
if tgtadm --op show -m target | grep "Target" >/dev/null ; then
echo $"Targets still in use. Cannot shutdown service."
RETVAL=1
return
fi
tgtadm --op delete --mode system
# killproc tgtd
echo
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/tgtd
}
show()
{
tgtadm --mode target --op show
}
restart()
{
stop
sleep 1
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status tgtd
RETVAL=$?
;;
show)
show
;;
condrestart)
[ -f /var/lock/subsys/tgtd ] && restart
;;
*)
echo $"Usage: $0 {start|stop|restart|status|show|condrestart}"
exit 1
esac
exit $RETVAL
_______________________________________________
Stgt-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/stgt-devel