ntp-client.rc 720 B

1234567891011121314151617181920212223242526272829303132
  1. #!/sbin/openrc-run
  2. # Copyright 1999-2013 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. depend() {
  5. before cron portmap
  6. after net
  7. use dns logger
  8. }
  9. checkconfig() {
  10. if ! type "${NTPCLIENT_CMD}" >/dev/null 2>&1 ; then
  11. eerror "Please edit /etc/conf.d/ntp-client"
  12. eerror "Unable to locate the client command ${NTPCLIENT_CMD}!"
  13. return 1
  14. fi
  15. if [ -z "${NTPCLIENT_OPTS}" ] ; then
  16. eerror "Please edit /etc/conf.d/ntp-client"
  17. eerror "I need to know what server/options to use!"
  18. return 1
  19. fi
  20. return 0
  21. }
  22. start() {
  23. checkconfig || return $?
  24. ebegin "Setting clock via the NTP client '${NTPCLIENT_CMD}'"
  25. "${NTPCLIENT_CMD}" ${NTPCLIENT_OPTS}
  26. eend $? "Failed to set clock"
  27. }