What's new

NTP Daemon for ASUSWRT/Merlin

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

The GUI let you see how good NTP performs in correcting your router's system clock.

The "offset" charts tell (over past 24 hours and past 7 days) the deviation of the system clock from true time. The "jitter" charts show uncertainty that NTP faces in correcting the system clock. So you can see when "jitter" (uncertainty) increases the "offset" (deviation from true time) flip flop with larger amplitude. It's fun to see from time to time..

You can remove the GUI. NTP will continue to run. But I feel people miss half if not most of the fun without those charts.

stats-ntp-offset.png

stats-ntp-sysjit.png
 
After install when I run ntpq -p it says read: unable to connect. What have I done wrong? How do you configure this?
 
Thanks for this. You are right, love the geeky graphs.

I notice that the system log file is filling up with an entry every five minutes when the cron job runs. Can this be stopped?
 
I installed this and got no errors. Nothing works though graphs and commands don't work. I get a read error when trying ntpq -p anyone have any ideas??
 
I installed this and got no errors. Nothing works though graphs and commands don't work. I get a read error when trying ntpq -p anyone have any ideas??

Diagnostic commands

Code:
which ntpd

/jffs/bin/ntpq -p

cru l | grep ntp

df | grep www

cat /www/state.js | grep NTP

opkg list-installed | grep rrdtool
 
Last edited:
Diagnostic commands

Code:
which ntpd

/jffs/bin/ntpq -p

cru l | grep ntp

df | grep www

cat /www/state.js | grep NTP

Results of diagnostics:
which ntpd......yields /usr/sbin/ntpd

/jffs/bin/ntpq -p........yields /jffs/bin/ntpq: read: Connection refused

Cru l | grep ntp.....the system accepts this with no output

Df | grep www......yields /dev/sdb1 14643106 342792 13519208 2% /www

cat /www/state.js | grep NTP......yields
tabtitle[16] = new Array ("", "Sysinfo", "Other Settings", "NTP Daemon");

opkg list-installed | grep red tool.....yields red tool - 1.2.30-3a

Does this help?
 
Results of diagnostics:
which ntpd......yields /usr/sbin/ntpd

/jffs/bin/ntpq -p........yields /jffs/bin/ntpq: read: Connection refused

Cru l | grep ntp.....the system accepts this with no output

Df | grep www......yields /dev/sdb1 14643106 342792 13519208 2% /www

cat /www/state.js | grep NTP......yields
tabtitle[16] = new Array ("", "Sysinfo", "Other Settings", "NTP Daemon");

opkg list-installed | grep red tool.....yields red tool - 1.2.30-3a

Does this help?

Well apart from confirming that you are seemingly incapable of simple copy'n'paste......where in my OP is the 'red tool' or the 'Cru' command?

Sadly installation procedures and their commands need to be followed/entered precisely (case sensitive etc.) otherwise how can your responses be trusted

e.g. when I copy'n'paste your Cru [sic] 'command'
Code:
Cru l | grep ntp
-sh: Cru: not found

Anyway certainly without the 'cru' schedule, the rrdtool graphs cannot be generated every 5 mins as expected.

Which URL did you follow to install @kvic's utility?
 
I get a read error when trying ntpq -p anyone have any ideas??
Did you use the full path to ntpq? The command should look like: /jffs/bin/ntpq -p
In my case it's resulting:
remote refid st t when poll reach delay offset jitter
==============================================================================
*usmia1-ntp-002. .GPSs. 1 u 701 1024 377 160.389 2.037 2.891
usdal2-ntp-002. .GPSs. 1 u 59m 1024 10 165.309 8.271 0.002
+jptyo5-ntp-002. .GPSs. 1 u 56m 1024 30 307.651 2.906 4.402
 
Well apart from confirming that you are seemingly incapable of simple copy'n'paste......where in my OP is the 'red tool' or the 'Cru' command?

Sadly installation procedures and their commands need to be followed/entered precisely (case sensitive etc.) otherwise how can your responses be trusted

e.g. when I copy'n'paste your Cru [sic] 'command'
Code:
Cru l | grep ntp
-sh: Cru: not found

Anyway certainly without the 'cru' schedule, the rrdtool graphs cannot be generated every 5 mins as expected.

Which URL did you follow to install @kvic's utility?

Used this guide: https://github.com/kvic-z/goodies-asuswrt/wiki/Install-NTP-Daemon-for-Asuswrt-Merlin

Sorry for the spell corrected results....at the time it was all I had access to.

Edit: I assure you I followed these install instructions precisely as I received no errors at all.
 
So if you followed the instructions..... why is there no cru for the 5 min script in step 6?

View attachment 9058

I checked my services-start script and you were right I added the line in the wrong spot. Corrected the placement and I can now run commands like ntpq -p . I restarted my router to see what happens. Still no graphs but this is new to me so I'm not certain if I would have graphs yet or not. At the risk of further humiliation I humbly ask for help.
 
I checked my services-start script and you were right I added the line in the wrong spot. Corrected the placement and I can now run commands like ntpq -p . I restarted my router to see what happens. Still no graphs but this is new to me so I'm not certain if I would have graphs yet or not. At the risk of further humiliation I humbly ask for help.

It would seem @Martineau that you got my drift. Anyway my graphs are starting to populate so we were successful in getting this running which is the prime directive here. I however have one last question for anyone willing to respond: When running this script do you still need the NTP Server setting on the administration page? Should you backspace it out is my question? Thanks in advance!
 
Did you use the full path to ntpq? The command should look like: /jffs/bin/ntpq -p
In my case it's resulting:
remote refid st t when poll reach delay offset jitter
==============================================================================
*usmia1-ntp-002. .GPSs. 1 u 701 1024 377 160.389 2.037 2.891
usdal2-ntp-002. .GPSs. 1 u 59m 1024 10 165.309 8.271 0.002
+jptyo5-ntp-002. .GPSs. 1 u 56m 1024 30 307.651 2.906 4.402

Yes sir I got this output now just wondering about the administration page NTP Server setting should it be backspaced out and will this syslog spam end at some point or is this going to be ongoing if so can the logging be stopped? As you are as well I'm getting hit every 5 minutes.
 
Thanks for this. You are right, love the geeky graphs.

I notice that the system log file is filling up with an entry every five minutes when the cron job runs. Can this be stopped?

Same here! Would really like a fix for this.
 
Hmmm........crickets?
 
RE: "NTP server" entry on Admin page

Pls leave it as-is. Your router's firmware need it on startup to initialise its system clock. The firmware does it through its so called "ntp" service.

Once the system clock is initialised, when Entware-ng starts, the script, /opt/etc/init.d/S77ntpd-custom will kill the firmware's "ntp" service and launch the true NTP daemon provided in the package of this thread.
 
RE: crond spams syslog every 5 minutes

crond is the firmware's task scheduler. Data from NTP daemon is collected for graphing every five minutes. It's done through a scheduled repetitive task every 5 minutes.

The firmware's crond will log its message to syslog. Hence, the many log messages..

How to not have crond spam my syslog?

The firmware comes with a primitive syslog service. For more advanced users, I recommend you to install syslog-ng from Entware-ng. Some details on how to run syslog-ng can be found on this thread.

Syslog-ng allows you to filter messages into different files based on application name and/or some keywords in the messages, and many more.

How to not have crond spam my syslog, again?

The firmware's crond is configured to output log to syslog. In fact, it has an option to output log to its own file. So you can try to put these two lines at the end of /jffs/scripts/services-start:

Code:
killall crond
crond -L <path/to/your_log_file>

Substitue <path/to/your_log_file> with your favourite choice. If you happen to have Entware-ng installed, I suggest "/opt/var/log/asuswrt-crond.log".

If you don't have Entware-ng installed but happen to have a USB stick attached, then modify the path prefix accordingly.

If you don't want to see any log from crond, use file "/dev/null" after "-L". It's not recommended.

Too good to be true?

Yes and no. The firmware's crond comes from Busybox. As of version 1.20.2, the "-L" option actually doesn't work as expected. crond will not log messages to the specified file. All messages basically sink into black hole..

But I only have this old Busybox to test on my RT-AC56U. If you try in new firmwares, a newer version of Busybox might work. Heck.. regardless what version though, this method can get rid of silly crond messages :)
 
Last edited:
Thank you for your response! Much appreciated!
 
RE: crond spams syslog every 5 minutes

crond is the firmware's task scheduler. Data from NTP daemon is collected for graphing every five minutes. It's done through a scheduled repetitive task every 5 minutes.

The firmware's crond will log its message to syslog. Hence, the many log messages..

How to not have crond spam my syslog?

The firmware comes with a primitive syslog service. For more advanced users, I recommend you to install syslog-ng from Entware-ng. Some details on how to run syslog-ng can be found on this thread.

Syslog-ng allows you to filter messages into different files based on application name and/or some keywords in the messages, and many more.

How to not have crond spam my syslog, again?

The firmware's crond is configured to output log to syslog. In fact, it has an option to output log to its own file. So you can try to put these two lines at the end of /jffs/scripts/services-start:

Code:
killall crond
crond -L <path/to/your_log_file>

Substitue <path/to/your_log_file> with your favourite choice. If you happen to have Entware-ng installed, I suggest "/opt/var/log/asuswrt-crond.log".

If you don't have Entware-ng installed but happen to have a USB stick attached, then modify the path prefix accordingly.

If you don't want to see any log from crond, use file "/dev/null" after "-L". It's not recommended.

Too good to be true?

Yes and no. The firmware's crond comes from Busybox. As of version 1.20.2, the "-L" option actually doesn't work as expected. crond will not log messages to the specified file. All messages basically sink into black hole..

But I only have this old Busybox to test on my RT-AC56U. If you try in new firmwares, a newer version of Busybox might work. Heck.. regardless what version though, this method can get rid of silly crond messages :)

Can I please ask one last thing? If you are running default logs setting, meaning I haven't played with where the logs are kept, what is the location of this syslog? Thanks sorry for being a newbie pain in the butt....lol
 
RE: crond spams syslog every 5 minutes

crond is the firmware's task scheduler. Data from NTP daemon is collected for graphing every five minutes. It's done through a scheduled repetitive task every 5 minutes.

The firmware's crond will log its message to syslog. Hence, the many log messages..

How to not have crond spam my syslog?

The firmware comes with a primitive syslog service. For more advanced users, I recommend you to install syslog-ng from Entware-ng. Some details on how to run syslog-ng can be found on this thread.

Syslog-ng allows you to filter messages into different files based on application name and/or some keywords in the messages, and many more.

How to not have crond spam my syslog, again?

The firmware's crond is configured to output log to syslog. In fact, it has an option to output log to its own file. So you can try to put these two lines at the end of /jffs/scripts/services-start:

Code:
killall crond
crond -L <path/to/your_log_file>

Substitue <path/to/your_log_file> with your favourite choice. If you happen to have Entware-ng installed, I suggest "/opt/var/log/asuswrt-crond.log".

If you don't have Entware-ng installed but happen to have a USB stick attached, then modify the path prefix accordingly.

If you don't want to see any log from crond, use file "/dev/null" after "-L". It's not recommended.

Too good to be true?

Yes and no. The firmware's crond comes from Busybox. As of version 1.20.2, the "-L" option actually doesn't work as expected. crond will not log messages to the specified file. All messages basically sink into black hole..

But I only have this old Busybox to test on my RT-AC56U. If you try in new firmwares, a newer version of Busybox might work. Heck.. regardless what version though, this method can get rid of silly crond messages :)

I did the modification of /jffs/scripts/services-start it worked excellent. Thank you!!
 

Latest threads

Sign Up For SNBForums Daily Digest

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