home *** CD-ROM | disk | FTP | other *** search
/ chilidog.highland.cc.ks.us / chilidog.highland.cc.ks.us.zip / chilidog.highland.cc.ks.us / backup / bradford.20120521.etc.tar.gz / bradford.20120521.etc.tar / etc / init.d / boot.sched < prev    next >
Text File  |  2004-09-20  |  2KB  |  84 lines

  1. #! /bin/sh
  2. #
  3. # Copyright (c) 2003 SuSE Linux AG, Nuernberg, Germany.
  4. # All rights reserved.
  5. #
  6. # /etc/init.d/boot.sched
  7. #
  8. ### BEGIN INIT INFO
  9. # Provides:          boot.sched
  10. # Required-Start:    boot.proc
  11. # Should-Start:    boot.localfs boot.ldconfig
  12. # Required-Stop:
  13. # Default-Start:     B
  14. # Default-Stop:
  15. # Description:       sets the scheduling timeslices
  16. ### END INIT INFO
  17.  
  18. . /etc/rc.status
  19. test -r /etc/sysconfig/kernel || exit 6
  20. . /etc/sysconfig/kernel
  21.  
  22. rc_reset
  23.  
  24. case "$1" in
  25.   start)
  26.     echo -n "Setting scheduling timeslices "
  27.     # Configured?
  28.     if test -z "$SCHED_MINTIMESLICE" -o -z "$SCHED_MAXTIMESLICE"; then
  29.         rc_failed 6
  30.     # Sanity?
  31.     elif test $((3*$SCHED_MINTIMESLICE)) -gt $SCHED_MAXTIMESLICE; then
  32.         echo -n "3*$SCHED_MINTIMESLICE > $SCHED_MAXTIMESLICE"
  33.         rc_failed 1
  34.     # Kernel support?
  35.     elif test ! -r /proc/sys/kernel/min-timeslice; then
  36.         echo -n "not supported by kernel ";
  37.         rc_failed 3
  38.     elif test ! -r /proc/sys/kernel/HZ; then
  39.         echo -n "kernel HZ unknown "
  40.         rc_failed 3
  41.     # Go!
  42.     else
  43.         # Make sure timeslice is at least as large as the minimum
  44.         read HZ < /proc/sys/kernel/HZ
  45.         MINSLICE=$((1000000/$HZ))
  46.         if test $MINSLICE -gt $SCHED_MINTIMESLICE; then
  47.             # Scale max timeslice
  48.             MAXSLICE=$(($SCHED_MAXTIMESLICE*$MINSLICE/$SCHED_MINTIMESLICE))
  49.             echo -n "$SCHED_MINTIMESLICE->$MINSLICE $SCHED_MAXTIMESLICE->$MAXSLICE"
  50.             SCHED_MINTIMESLICE=$MINSLICE
  51.             SCHED_MAXTIMESLICE=$MAXSLICE
  52.         else
  53.             echo -n "$SCHED_MINTIMESLICE $SCHED_MAXTIMESLICE "
  54.         fi    
  55.         echo $SCHED_MINTIMESLICE > /proc/sys/kernel/min-timeslice
  56.         rc_status
  57.         if test -e /proc/sys/kernel/def-timeslice; then
  58.             echo $((($SCHED_MAXTIMESLICE+$MINSLICE)/2)) > /proc/sys/kernel/def-timeslice
  59.             rc_status
  60.         else    
  61.             echo $SCHED_MAXTIMESLICE > /proc/sys/kernel/max-timeslice
  62.             rc_status
  63.         fi
  64.     fi
  65.     true
  66.     rc_status -v
  67.     ;;
  68.     
  69.     stop|restart)
  70.         # skip / nothing to do
  71.     ;;
  72.     status)
  73.     rc_failed 4
  74.     rc_status -v
  75.     ;;
  76.     *)
  77.     echo "Usage: $0 {start|stop|status|restart}"
  78.     exit 1
  79.     ;;
  80. esac
  81.  
  82. rc_exit
  83.  
  84.