setclock 834 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. ########################################################################
  3. # Begin $rc_base/init.d/setclock
  4. #
  5. # Description : Setting Linux Clock
  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. . /etc/sysconfig/clock
  17. case "${UTC}" in
  18. yes|true|1)
  19. CLOCKPARAMS="${CLOCKPARAMS} --utc"
  20. ;;
  21. no|false|0)
  22. CLOCKPARAMS="${CLOCKPARAMS} --localtime"
  23. ;;
  24. esac
  25. case ${1} in
  26. start)
  27. boot_mesg "Setting system clock..."
  28. hwclock --hctosys ${CLOCKPARAMS} >/dev/null
  29. evaluate_retval
  30. ;;
  31. stop)
  32. boot_mesg "Setting hardware clock..."
  33. hwclock --systohc ${CLOCKPARAMS} >/dev/null
  34. evaluate_retval
  35. ;;
  36. *)
  37. echo "Usage: ${0} {start|stop}"
  38. ;;
  39. esac