--- /dev/null
+#!/bin/bash
+
+# tune
+# Tune kernel parameters for hardware
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+tune_disks()
+{
+ cd /sys/block
+
+ for disk in * ; do
+ if cat /sys/block/${disk}/queue/rotational | grep -q 1 ; then
+ echo "cfq" > /sys/block/${disk}/queue/scheduler
+ else
+ # SSD
+ echo "deadline" > /sys/block/${disk}/queue/scheduler
+ fi
+
+ echo -n "Scheduler for disk ${disk} = "
+ cat /sys/block/${disk}/queue/scheduler | sed "s/.*\[\(.*\)\].*/\1/"
+ done
+}
+
+case "${1}" in
+ start)
+ cmd_run_log_box "Tuning disk parameters" tune_disks
+ ;;
+ *)
+ echo "Usage: $0 {start}"
+ exit ${EXIT_CODE_FAILURE}
+ ;;
+esac
+
+exit $?
bootscript_add_rcsysinit initlog 05 00
bootscript_add_rcsysinit hostname 10 00
bootscript_add_rcsysinit mountkernfs 15 00
+bootscript_add_rcsysinit tune 17 00
bootscript_add_rcsysinit modules 20 00
bootscript_add_rcsysinit udev 25 00
bootscript_add_rcsysinit checkfs 30 00