Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 307619 | Differences between
and this patch

Collapse All | Expand All

(-)/tmp/iscsid (-12 / +16 lines)
Lines 1-7 Link Here
1
#!/sbin/runscript
1
#!/sbin/runscript
2
# Copyright 1999-2008 Gentoo Technologies, Inc.
2
# Copyright 1999-2010 Gentoo Technologies, Inc.
3
# Distributed under the terms of the GNU General Public License, v2 or later
3
# Distributed under the terms of the GNU General Public License, v2 or later
4
# $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 $
4
# $Header: $
5
5
6
opts="${opts} starttargets stoptargets restarttargets"
6
opts="${opts} starttargets stoptargets restarttargets"
7
7
Lines 10-15 Link Here
10
	use net
10
	use net
11
}
11
}
12
12
13
PIDFILE=${PIDFILE:-/var/run/${SVCNAME}.pid}
14
BINARY="/usr/sbin/iscsid"
15
13
checkconfig() {
16
checkconfig() {
14
	if [ ! -e /etc/conf.d/${SVCNAME} ]; then
17
	if [ ! -e /etc/conf.d/${SVCNAME} ]; then
15
		eerror "Config file /etc/conf.d/${SVCNAME} does not exist!"
18
		eerror "Config file /etc/conf.d/${SVCNAME} does not exist!"
Lines 71-77 Link Here
71
	fi
74
	fi
72
75
73
	ebegin "Starting ${SVCNAME}"
76
	ebegin "Starting ${SVCNAME}"
74
	start-stop-daemon --start --quiet --exec /usr/sbin/iscsid -- ${OPTS}
77
	start-stop-daemon --start --quiet --exec ${BINARY} -- ${OPTS}
75
	ret=$?
78
	ret=$?
76
	if [ $ret -ne 0 ]; then
79
	if [ $ret -ne 0 ]; then
77
		eend $?
80
		eend $?
Lines 81-87 Link Here
81
	# Start automatic targets when iscsid is started
84
	# Start automatic targets when iscsid is started
82
	if [ "${AUTOSTARTTARGETS}" = "yes" ]; then
85
	if [ "${AUTOSTARTTARGETS}" = "yes" ]; then
83
		starttargets
86
		starttargets
84
		return $?
87
		ret=$?
88
		if [ "${AUTOSTART}" = "strict" ] && [ $ret -ne 0 ]; then
89
			stop
90
			return $ret
91
		fi
85
	fi
92
	fi
86
	return 0
93
	return 0
87
}
94
}
Lines 89-100 Link Here
89
stop() {
96
stop() {
90
	stoptargets
97
	stoptargets
91
	ebegin "Stopping ${SVCNAME}"
98
	ebegin "Stopping ${SVCNAME}"
92
	start-stop-daemon --signal HUP --stop --quiet --exec /usr/sbin/iscsid #--pidfile $PID_FILE
99
	start-stop-daemon --stop --quiet --exec ${BINARY} --pidfile ${PIDFILE}
93
	eend $?
100
	eend $?
94
101
95
	# ugly, but pid file is not removed by iscsid
96
	rm -f $PID_FILE
97
	
98
	do_modules 'Removing iSCSI modules' 'iscsi_tcp scsi_transport_iscsi libiscsi' '-r'
102
	do_modules 'Removing iSCSI modules' 'iscsi_tcp scsi_transport_iscsi libiscsi' '-r'
99
	eend $?
103
	eend $?
100
}
104
}
Lines 102-119 Link Here
102
starttargets() {
106
starttargets() {
103
        ebegin "Setting up iSCSI targets"
107
        ebegin "Setting up iSCSI targets"
104
        /usr/sbin/iscsiadm -m node --loginall=automatic
108
        /usr/sbin/iscsiadm -m node --loginall=automatic
105
		ret=$?
109
	ret=$?
106
        eend $ret
110
        eend $ret
107
		return $ret
111
	return $ret
108
}
112
}
109
113
110
stoptargets() {
114
stoptargets() {
111
        ebegin "Disconnecting iSCSI targets"
115
        ebegin "Disconnecting iSCSI targets"
112
        sync
116
        sync
113
        /usr/sbin/iscsiadm -m node --logoutall=all
117
        /usr/sbin/iscsiadm -m node --logoutall=all
114
		ret=$?
118
	ret=$?
115
        eend $ret
119
        eend $ret
116
		return $ret
120
	return $ret
117
}
121
}
118
122
119
restarttargets() {
123
restarttargets() {

Return to bug 307619