Files
2026-10-07 18:47:42 +08:00

23 lines
623 B
Bash

#!/bin/sh
[ "$ACTION" = "step" ] || exit 0
offset=${offset#-}
offset=${offset%.*}
# Skip service restart if the time adjustment is less than 120 seconds.
[ "$offset" -lt 120 ] && exit 0
. /usr/share/passwall/utils.sh
NTP_LOCK_FILE="${LOCK_PATH}/${CONFIG}_ntp.lock"
[ -f "${NTP_LOCK_FILE}" ] && exit 0
([ "$(get_cache_var "ENABLED_DEFAULT_ACL")" = "1" ] || [ "$(get_cache_var "ENABLED_ACLS")" = "1" ]) && [ -f ${LOCK_PATH}/${CONFIG}_ready.lock ] && {
echo $$ > ${NTP_LOCK_FILE}
/etc/init.d/${CONFIG} restart >/dev/null 2>&1 &
logger -p notice -t network -s "${CONFIG}: restart after NTP time step (${offset}s)"
}