Files
scst/iscsi-scst/etc/initd/initd.gentoo
T

79 lines
1.7 KiB
Plaintext

#!/sbin/runscript
#
# System startup script for the SCST iSCSI functionality.
#
# Customized for gentoo linux by Scott Bowe.
#
# Note: on most Linux distributions /bin/sh is a soft link to /bin/bash, while
# on a default Ubuntu setup /bin/sh is a soft link to /bin/dash !
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
MEM_SIZE=1048576
depend()
{
use net
need scst
}
configure_memsize()
{
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
}
start_server()
{
# configure_memsize
modprobe -q crc32c 2>/dev/null
modprobe -q crc32c-intel 2>/dev/null
modprobe iscsi-scst
/usr/local/sbin/iscsi-scstd
/usr/local/sbin/scstadmin -config /etc/scst.conf
}
stop_server()
{
killall iscsi-scstd
rmmod -w iscsi-scst
}
start()
{
ebegin "Starting iscsi"
start_server
eend 0
}
stop()
{
ebegin "Stopping iscsi"
stop_server
eend 0
}