diff options
Diffstat (limited to 'main/iscsi-scst/iscsi-scst.initd')
-rw-r--r-- | main/iscsi-scst/iscsi-scst.initd | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/main/iscsi-scst/iscsi-scst.initd b/main/iscsi-scst/iscsi-scst.initd new file mode 100644 index 0000000000..b63a3e57d8 --- /dev/null +++ b/main/iscsi-scst/iscsi-scst.initd @@ -0,0 +1,68 @@ +#!/sbin/runscript +# +# Start the iSCSI-SCST Target. +# + +depend() { + need net + after firewall +} + +configure_memsize() { + if [ ! -z "$MEM_SIZE" ]; then + if [ -e /proc/sys/net/core/wmem_max ]; then + echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max + fi + + if [ -e /proc/sys/net/core/rmem_max ]; then + echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max + fi + + if [ -e /proc/sys/net/core/wmem_default ]; then + echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default + fi + + if [ -e /proc/sys/net/core/rmem_default ]; then + echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default + fi + + if [ -e /proc/sys/net/ipv4/tcp_mem ]; then + echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem + fi + + if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then + echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem + fi + + if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then + echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem + fi + fi +} + +check_dev_handlers() { + if lsmod | grep "scst_" >/dev/null; then + ewarn "Device handlers found" + else + ewarn "No SCST device handlers loaded!" + ewarn "You can add them in /etc/modules" + fi +} + +start() { + ebegin "Starting iscsi" + check_dev_handlers + modprobe -q crc32c + modprobe -q iscsi-scst + start-stop-daemon --start --exec /usr/sbin/iscsi-scstd + /usr/sbin/scstadmin -config /etc/scst.conf + eend 0 +} + +stop() { + ebegin "Stopping iscsi" + start-stop-daemon --stop --exec /usr/sbin/iscsi-scstd + rmmod -w iscsi-scst + eend 0 +} + |