ntpMerlin ntpMerlin - NTP Daemon for AsusWRT Merlin

  • ATTENTION! You'll notice a Prefix dropdown when you create a thread. If your post applies to one of the topics listed, please use that Prefix for your post. When browsing the thread list you can use the Prefix to filter the view.

Jack Yaz

Part of the Furniture
v3.0.0
Updated 2020-10-24

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.

ntpMerlin is free to use under the GNU General Public License version 3 (GPL 3.0).

This project is hosted on GitHub

Love the script and want to support future development? Any and all donations gratefully received!
PayPal donation
Buy me a coffee

Supported firmware versions
You must be running Merlin 384.15/384.13_4 or Fork 43E5 (or later) Asuswrt-Merlin

Installation
Using your preferred SSH client/terminal, copy and paste the following command, then press Enter:
Code:
/usr/sbin/curl --retry 3 "https://raw.githubusercontent.com/jackyaz/ntpMerlin/master/ntpmerlin.sh" -o "/jffs/scripts/ntpmerlin" && chmod 0755 /jffs/scripts/ntpmerlin && /jffs/scripts/ntpmerlin install
Usage
WebUI
ntpMerlin can be configured via the WebUI, in the Addons section.

Command Line
To launch the ntpMerlin menu after installation, use:
Code:
ntpmerlin
If this does not work, you will need to use the full path:
Code:
/jffs/scripts/ntpmerlin
 
Last edited:

Butterfly Bones

Very Senior Member
Thank you, I tired this on my AC86U about a year ago and had problems getting it to work. At the same time I was trying to setup syslog-ng and had more serious issues. I finally gave up on both.

I just ran this script and it was so quick and painless I almost thought it did not work.

Now the question is does it use the time server settings in the router? No reason to think otherwise, I just had too many attempts to contact servers in countries that I would rather not have connection attempts.

This looks like another candidate for @thelonelycoder to add to amtm menu. :D
 

EmeraldDeer

Very Senior Member
Thank you, I tired this on my AC86U about a year ago and had problems getting it to work. At the same time I was trying to setup syslog-ng and had more serious issues. I finally gave up on both.

I just ran this script and it was so quick and painless I almost thought it did not work.

Now the question is does it use the time server settings in the router? No reason to think otherwise, I just had too many attempts to contact servers in countries that I would rather not have connection attempts.

This looks like another candidate for @thelonelycoder to add to amtm menu. :D
No, ntpd uses the time server settings in /jffs/configs/ntp.conf. By default this is pool.ntp.org servers which use geolocation DNS. However, I have noticed inconsistent results. You may want to use more specific pool servers such as 0.us.pool.ntp.org.
 

Butterfly Bones

Very Senior Member
No, ntpd uses the time server settings in /jffs/configs/ntp.conf. By default this is pool.ntp.org servers which use geolocation DNS. However, I have noticed inconsistent results. You may want to use more specific pool servers such as 0.us.pool.ntp.org.
Ok, I added the four suggested on the NTP site for the us, 0-3 as you show. Now I am getting results in the graph, before that change it was not showing anything.
 

cmkelley

Very Senior Member
ACK!!! Jack, please use logger, not sed to write to syslog. Those of us that use syslog-ng almost as a rule have syslog.log symlinked to a file on a USB device. When you sed to it you destroy the symlink.
 
Last edited:

Butterfly Bones

Very Senior Member
ACK!!! Jack, please use logger, not sed to write to syslog. Those of us that use syslog-ng almost as a rule have syslog.log symlinked to a file on a USB device. When you sed to it you destroy the symlink.
That was my original problem a year back trying to setup syslog-ng, was the symlink being killed. This is too bad, I like this graph. :oops:
 

cmkelley

Very Senior Member
ACK!!! Jack, please use logger, not sed to write to syslog. Those of us that use syslog-ng almost as a rule have syslog.log symlinked to a file on a USB device. When you sed to it you destroy the symlink.
Misread the sed line, Jack is deleting something from the syslog, not writing to it. Same problem, please don't do that either Jack. :)
 

JDB

Very Senior Member
Misread the sed line, Jack is deleting something from the syslog, not writing to it. Same problem, please don't do that either Jack. :)
Just need to add --follow-symlink to the sed command


Sent from my iPhone using Tapatalk
 

cmkelley

Very Senior Member
Just need to add --follow-symlink to the sed command
--follow-symlink isn't compiled into busybox's sed. Using that would require installing Entware's sed.
 

Jack Yaz

Part of the Furniture
ACK!!! Jack, please use logger, not sed to write to syslog. Those of us that use syslog-ng almost as a rule have syslog.log symlinked to a file on a USB device. When you sed to it you destroy the symlink.
Sadly dropping that line means a cron line being printed every 5 minutes. Syslog-ng users feel free to comment the line in the script for the time being - until I can find a way to keep everyone happy
 

Jack Yaz

Part of the Furniture
Sadly dropping that line means a cron line being printed every 5 minutes. Syslog-ng users feel free to comment the line in the script for the time being - until I can find a way to keep everyone happy
And on that note... I think I've got something

@cmkelley could you confirm how/where you symlink the log files to?
 

cmkelley

Very Senior Member
Also, slightly off-topic, but is there a way I can route all ntp traffic EXCEPT from one particular IP on my network to be routed to that same IP? I have a gps-driven time server on an RPi, so my ntp.conf file on the router just points to it (I take a perverse pleasure in seeing that my network time is accurate to ~10 usec). I think I read somewhere it's not a good idea to use a GPS timeserver completely stand-alone, it should point to some external time servers as well. Can't remember the logic behind that though.
 

Jack Yaz

Part of the Furniture
Also, slightly off-topic, but is there a way I can route all ntp traffic EXCEPT from one particular IP on my network to be routed to that same IP? I have a gps-driven time server on an RPi, so my ntp.conf file on the router just points to it (I take a perverse pleasure in seeing that my network time is accurate to ~10 usec). I think I read somewhere it's not a good idea to use a GPS timeserver completely stand-alone, it should point to some external time servers as well. Can't remember the logic behind that though.
Yes, I think you can add -s ! IP to the dnat rule in the script

(if not that, then ! -s IP)
 

JDB

Very Senior Member
--follow-symlink isn't compiled into busybox's sed. Using that would require installing Entware's sed.
Given this script now relies on entware anyway is that an issue


Sent from my iPhone using Tapatalk
 

cmkelley

Very Senior Member
Given this script now relies on entware anyway is that an issue
Entware's sed is not automatically installed with Entware. If we can get away with not requiring it, so much the better.
 

Jack Yaz

Part of the Furniture
Given this script now relies on entware anyway is that an issue


Sent from my iPhone using Tapatalk
My current idea shouldn't require any additional packages. I would script it to test now but its 6.30am and my wife and pets are still quietly asleep, so I'm reluctant to disturb them!

I have to get up around 7 anyway to take the dog for a walk, so there should be time for a small update this morning
 

JDB

Very Senior Member
My current idea shouldn't require any additional packages. I would script it to test now but its 6.30am and my wife and pets are still quietly asleep, so I'm reluctant to disturb them!

I have to get up around 7 anyway to take the dog for a walk, so there should be time for a small update this morning
Guess it’s easy enough to sed to a tmp file and then cat it into the original - that would follow the symlink and is all that -i does anyway.


Sent from my iPhone using Tapatalk
 

ColH

Occasional Visitor
Code:
 Checking ntpd...              dead.
 Starting ntpd...              failed.
ntpq: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
Receive the above when running the script; what am I missing?
 
Similar threads
Thread starter Title Forum Replies Date
P amtm AMTM - NTP not ready, check that router time is synced Asuswrt-Merlin AddOns 2

Similar threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top