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.

20 lines
605 B

  1. #!/bin/sh
  2. # ntp hotplug script for travelmate
  3. # Copyright (c) 2020-2021 Dirk Brenken (dev@brenken.org)
  4. # This is free software, licensed under the GNU General Public License v3.
  5. # set (s)hellcheck exceptions
  6. # shellcheck disable=3023
  7. trm_init="/etc/init.d/travelmate"
  8. trm_ntpfile="/var/state/travelmate.ntp"
  9. trm_logger="$(command -v logger)"
  10. if [ "${ACTION}" = "stratum" ] && [ ! -f "${trm_ntpfile}" ] && "${trm_init}" enabled; then
  11. {
  12. if flock -xn 1001; then
  13. "${trm_logger}" -p "info" -t "trm-ntp [${$}]" "get ntp time sync" 2>/dev/null
  14. "${trm_init}" restart
  15. fi
  16. } 1001>"${trm_ntpfile}"
  17. fi