0
0
mirror of https://github.com/openwrt/packages.git synced 2025-02-07 08:09:51 +00:00
packages/net/travelmate/files/travelmate_ntp.hotplug
Dirk Brenken 7f976e1602 travelmate: update to 2.1.3-1
* fixed STA connection issues / restart the travelmate interface on new connections via ubus
* fixed NTP hotplug issues / trigger the NTP hotplug event via ubus
* fixed minor log issues (mail/hotplug)
* readme update

Signed-off-by: Dirk Brenken <dev@brenken.org>
2024-09-14 13:48:27 +02:00

20 lines
789 B
Bash
Executable File

#!/bin/sh
# ntp hotplug script for travelmate
# Copyright (c) 2020-2024 Dirk Brenken (dev@brenken.org)
# This is free software, licensed under the GNU General Public License v3.
# set (s)hellcheck exceptions
# shellcheck disable=all
trm_init="/etc/init.d/travelmate"
trm_ntpfile="/var/state/travelmate.ntp"
if [ "${ACTION}" = "stratum" ] && [ ! -s "${trm_ntpfile}" ] && "${trm_init}" enabled; then
printf "%s" "$(date "+%Y.%m.%d-%H:%M:%S")" > "${trm_ntpfile}"
trm_ubuscmd="$(command -v ubus)"
trm_jsoncmd="$(command -v jsonfilter)"
trm_logger="$(command -v logger)"
trm_ver="$("${trm_ubuscmd}" -S call rpc-sys packagelist '{ "all": true }' 2>/dev/null | "${trm_jsoncmd}" -ql1 -e '@.packages.travelmate')"
"${trm_logger}" -p "info" -t "trm-${trm_ver}[${$}]" "get ntp time sync"
fi