diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2012-02-09 08:35:05 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2012-02-09 08:35:05 +0000 |
commit | bf55f8dee1ca081014d60b9b4ac798d1d98b9829 (patch) | |
tree | 0e1df1183d124e46230758eff401543ae161b969 /sys-block/open-iscsi/files | |
parent | Bug #383437: Fix iSNS SLP linking in the main binaries. (diff) | |
download | gentoo-2-bf55f8dee1ca081014d60b9b4ac798d1d98b9829.tar.gz gentoo-2-bf55f8dee1ca081014d60b9b4ac798d1d98b9829.tar.bz2 gentoo-2-bf55f8dee1ca081014d60b9b4ac798d1d98b9829.zip |
Bug #307619: improve init script for BL2.
(Portage version: 2.2.0_alpha84/cvs/Linux x86_64)
Diffstat (limited to 'sys-block/open-iscsi/files')
-rw-r--r-- | sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d | 28 | ||||
-rw-r--r-- | sys-block/open-iscsi/files/iscsid-conf.d | 5 |
2 files changed, 21 insertions, 12 deletions
diff --git a/sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d b/sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d index 179c131923eb..afcdb5f76d96 100644 --- a/sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d +++ b/sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d @@ -1,7 +1,7 @@ #!/sbin/runscript -# Copyright 1999-2008 Gentoo Technologies, Inc. +# Copyright 1999-2012 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License, v2 or later -# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d,v 1.1 2009/11/12 09:29:48 robbat2 Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d,v 1.2 2012/02/09 08:35:05 robbat2 Exp $ opts="${opts} starttargets stoptargets restarttargets" @@ -10,6 +10,9 @@ depend() { use net } +PIDFILE=${PIDFILE:-/var/run/${SVCNAME}.pid} +BINARY="/usr/sbin/iscsid" + checkconfig() { if [ ! -e /etc/conf.d/${SVCNAME} ]; then eerror "Config file /etc/conf.d/${SVCNAME} does not exist!" @@ -71,7 +74,7 @@ start() { fi ebegin "Starting ${SVCNAME}" - start-stop-daemon --start --quiet --exec /usr/sbin/iscsid -- ${OPTS} + start-stop-daemon --start --quiet --exec ${BINARY} -- ${OPTS} ret=$? if [ $ret -ne 0 ]; then eend $? @@ -81,7 +84,11 @@ start() { # Start automatic targets when iscsid is started if [ "${AUTOSTARTTARGETS}" = "yes" ]; then starttargets - return $? + ret=$? + if [ "${AUTOSTART}" = "strict" ] && [ $ret -ne 0 ]; then + stop + return $ret + fi fi return 0 } @@ -89,12 +96,9 @@ start() { stop() { stoptargets ebegin "Stopping ${SVCNAME}" - start-stop-daemon --signal HUP --stop --quiet --exec /usr/sbin/iscsid #--pidfile $PID_FILE + start-stop-daemon --stop --quiet --exec ${BINARY} --pidfile ${PIDFILE} eend $? - # ugly, but pid file is not removed by iscsid - rm -f $PID_FILE - do_modules 'Removing iSCSI modules' 'iscsi_tcp scsi_transport_iscsi libiscsi' '-r' eend $? } @@ -102,18 +106,18 @@ stop() { starttargets() { ebegin "Setting up iSCSI targets" /usr/sbin/iscsiadm -m node --loginall=automatic - ret=$? + ret=$? eend $ret - return $ret + return $ret } stoptargets() { ebegin "Disconnecting iSCSI targets" sync /usr/sbin/iscsiadm -m node --logoutall=all - ret=$? + ret=$? eend $ret - return $ret + return $ret } restarttargets() { diff --git a/sys-block/open-iscsi/files/iscsid-conf.d b/sys-block/open-iscsi/files/iscsid-conf.d index 1c4cc4054264..02e584fbce52 100644 --- a/sys-block/open-iscsi/files/iscsid-conf.d +++ b/sys-block/open-iscsi/files/iscsid-conf.d @@ -11,3 +11,8 @@ OPTS="-i ${INITIATORNAME_FILE}" # Start automatic targets when iscsid is started AUTOSTARTTARGETS="yes" + +# if set to "strict", iscsid will stop, if connecting the +# autostart targets failed +# AUTOSTART="strict" + |