mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.1 KiB

  1. #!/bin/sh
  2. #
  3. # ROCK Linux: /etc/rc.d/rc
  4. #
  5. # This script does the switching between runlevels.
  6. #
  7. {
  8. echo "** Running rc script **"
  9. echo "rc: Previous runlevel: $PREVLEVEL, new runlevel: $RUNLEVEL."
  10. curdir=/etc/rc.d/rc$RUNLEVEL.d
  11. prevdir=/etc/rc.d/rc$PREVLEVEL.d
  12. #
  13. # run the KILL scripts of the previous runlevel (if needed)
  14. #
  15. if ! [ $PREVLEVEL = S -o $PREVLEVEL = N ]
  16. then
  17. echo "RC: Leave runlevel $PREVLEVEL ..."
  18. for i in $prevdir/K*; do
  19. test -x "$i" || continue
  20. x="`echo "$i" | sed "s,$prevdir/K..,$curdir/S??,"`"
  21. [ "`echo $x`" = "$x" ] || continue
  22. /sbin/rc --nobtee $i stop
  23. done
  24. fi
  25. echo "rc: Enter runlevel $RUNLEVEL ..."
  26. #
  27. # run the START scripts of the current (new) runlevel
  28. #
  29. if [ $RUNLEVEL != 0 -a $RUNLEVEL != 6 -a $RUNLEVEL != S ]
  30. then
  31. for i in $curdir/S*; do
  32. test -x "$i" || continue
  33. x="`echo "$i" | sed "s,$curdir/S..,$prevdir/K??,"`"
  34. [ "`echo $x`" = "$x" ] || continue
  35. /sbin/rc --nobtee $i start
  36. done
  37. fi
  38. echo "rc: The system is now in runlevel $RUNLEVEL."
  39. # write EOT mark for btee
  40. echo -ne '\004'
  41. } 2>&1 | /sbin/btee a /var/log/init.msg
  42. exit 0