swap 825 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. ########################################################################
  3. # Begin $rc_base/init.d/swap
  4. #
  5. # Description : Swap Control Script
  6. #
  7. # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
  8. #
  9. # Version : 00.00
  10. #
  11. # Notes :
  12. #
  13. ########################################################################
  14. . /etc/sysconfig/rc
  15. . ${rc_functions}
  16. case "${1}" in
  17. start)
  18. boot_mesg "Activating all swap files/partitions..."
  19. swapon -a
  20. evaluate_retval
  21. ;;
  22. stop)
  23. boot_mesg "Deactivating all swap files/partitions..."
  24. swapoff -a
  25. evaluate_retval
  26. ;;
  27. restart)
  28. ${0} stop
  29. sleep 1
  30. ${0} start
  31. ;;
  32. status)
  33. boot_mesg "Retrieving swap status." ${INFO}
  34. echo_ok
  35. echo
  36. swapon -s
  37. ;;
  38. *)
  39. echo "Usage: ${0} {start|stop|restart|status}"
  40. exit 1
  41. ;;
  42. esac
  43. # End $rc_base/init.d/swap