Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ntpMerlin

## v3.4.11
### Updated on 2025-Nov-08
## v3.4.12
### Updated on 2025-Nov-16

## About
ntpMerlin implements an NTP time server for AsusWRT Merlin with charts for daily, weekly and monthly summaries of performance. A choice between ntpd and chrony is available.
Expand Down
26 changes: 17 additions & 9 deletions ntpmerlin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
## Forked from https://github.com/jackyaz/ntpMerlin ##
## ##
##############################################################
# Last Modified: 2025-Nov-04
# Last Modified: 2025-Nov-16
#-------------------------------------------------------------

############### Shellcheck directives #############
Expand All @@ -36,8 +36,8 @@
### Start of script variables ###
readonly SCRIPT_NAME="ntpMerlin"
readonly SCRIPT_NAME_LOWER="$(echo "$SCRIPT_NAME" | tr 'A-Z' 'a-z' | sed 's/d//')"
readonly SCRIPT_VERSION="v3.4.11"
readonly SCRIPT_VERSTAG="25110422"
readonly SCRIPT_VERSION="v3.4.12"
readonly SCRIPT_VERSTAG="25111608"
SCRIPT_BRANCH="develop"
SCRIPT_REPO="https://raw.githubusercontent.com/AMTM-OSR/$SCRIPT_NAME/$SCRIPT_BRANCH"
readonly SCRIPT_DIR="/jffs/addons/$SCRIPT_NAME_LOWER.d"
Expand Down Expand Up @@ -478,7 +478,7 @@ Validate_Number()
}

##----------------------------------------##
## Modified by Martinski W. [2025-Jan-19] ##
## Modified by Martinski W. [2025-Nov-15] ##
##----------------------------------------##
Conf_FromSettings()
{
Expand Down Expand Up @@ -507,7 +507,7 @@ Conf_FromSettings()
rm -f "$TMPFILE"
rm -f "${SETTINGSFILE}.bak"

if diff "$SCRIPT_CONF" "${SCRIPT_CONF}.bak" | grep -q "STORAGELOCATION="
if diff -U0 "$SCRIPT_CONF" "${SCRIPT_CONF}.bak" | grep -qE "[-+]STORAGELOCATION="
then
STORAGEtype="$(ScriptStorageLocation check)"
if [ "$STORAGEtype" = "jffs" ]
Expand All @@ -521,13 +521,15 @@ Conf_FromSettings()
then
ScriptStorageLocation usb
fi
Create_Dirs
Conf_Exists
Create_Symlinks
fi
if diff "$SCRIPT_CONF" "${SCRIPT_CONF}.bak" | grep -qE "(OUTPUTTIMEMODE=|DAYSTOKEEP=|LASTXRESULTS=)"
if diff -U0 "$SCRIPT_CONF" "${SCRIPT_CONF}.bak" | grep -qE "(OUTPUTTIMEMODE=|DAYSTOKEEP=|LASTXRESULTS=)"
then
Generate_CSVs
fi
if diff "$SCRIPT_CONF" "${SCRIPT_CONF}.bak" | grep -q "TIMESERVER="
if diff -U0 "$SCRIPT_CONF" "${SCRIPT_CONF}.bak" | grep -qE "[-+]TIMESERVER="
then
TimeServer "$(TimeServer check)"
fi
Expand Down Expand Up @@ -1265,7 +1267,10 @@ ScriptStorageLocation()
mkdir -p "/opt/share/$SCRIPT_NAME_LOWER.d/"
rm -f "/jffs/addons/$SCRIPT_NAME_LOWER.d/ntpdstats.db-shm"
rm -f "/jffs/addons/$SCRIPT_NAME_LOWER.d/ntpdstats.db-wal"
[ -d "/opt/share/$SCRIPT_NAME_LOWER.d/csv" ] && rm -fr "/opt/share/$SCRIPT_NAME_LOWER.d/csv"
if [ -d "/opt/share/$SCRIPT_NAME_LOWER.d/csv" ] && \
[ -d "/jffs/addons/$SCRIPT_NAME_LOWER.d/csv" ]
then rm -fr "/opt/share/$SCRIPT_NAME_LOWER.d/csv"
fi
mv -f "/jffs/addons/$SCRIPT_NAME_LOWER.d/csv" "/opt/share/$SCRIPT_NAME_LOWER.d/" 2>/dev/null
mv -f "/jffs/addons/$SCRIPT_NAME_LOWER.d/config" "/opt/share/$SCRIPT_NAME_LOWER.d/" 2>/dev/null
mv -f "/jffs/addons/$SCRIPT_NAME_LOWER.d/config.bak" "/opt/share/$SCRIPT_NAME_LOWER.d/" 2>/dev/null
Expand All @@ -1290,7 +1295,10 @@ ScriptStorageLocation()
TIMESERVER_NAME="$(TimeServer check)"
sed -i 's/^STORAGELOCATION.*$/STORAGELOCATION=jffs/' "$SCRIPT_CONF"
mkdir -p "/jffs/addons/$SCRIPT_NAME_LOWER.d/"
[ -d "/jffs/addons/$SCRIPT_NAME_LOWER.d/csv" ] && rm -fr "/jffs/addons/$SCRIPT_NAME_LOWER.d/csv"
if [ -d "/opt/share/$SCRIPT_NAME_LOWER.d/csv" ] && \
[ -d "/jffs/addons/$SCRIPT_NAME_LOWER.d/csv" ]
then rm -fr "/jffs/addons/$SCRIPT_NAME_LOWER.d/csv"
fi
mv -f "/opt/share/$SCRIPT_NAME_LOWER.d/csv" "/jffs/addons/$SCRIPT_NAME_LOWER.d/" 2>/dev/null
mv -f "/opt/share/$SCRIPT_NAME_LOWER.d/config" "/jffs/addons/$SCRIPT_NAME_LOWER.d/" 2>/dev/null
mv -f "/opt/share/$SCRIPT_NAME_LOWER.d/config.bak" "/jffs/addons/$SCRIPT_NAME_LOWER.d/" 2>/dev/null
Expand Down