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