[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:hardware:arm:automatically_setting_system_time_on_arm_devices [2021/03/14 22:56 (UTC)] – [Automatically setting the system time with an Internet connection] revised header exagahowtos:hardware:arm:automatically_setting_system_time_on_arm_devices [2021/03/22 09:26 (UTC)] (current) – [Automatically setting the system time with an Internet connection] typo script filename extension exaga
Line 12: Line 12:
 Most (if not all?) modern PC systems come with an onboard real time clock (RTC) installed on the mainboard, whereas most single board computer ARM devices do not.  Most (if not all?) modern PC systems come with an onboard real time clock (RTC) installed on the mainboard, whereas most single board computer ARM devices do not. 
  
-For example, the Raspberry Pi (a.k.a. the most common and popular single board computer on the planet) cannot seem to factor in an onboard timekeeper within its MSRP, even on the more expensive models which feature larger amounts of RAM but still no RTC. The Banana Pi, Orange Pi, and Asus Tinkerboard devices do not feature an onboard RTC. Less common devices, such as SolidRun's HummingBoard Pro, the NanoPi (Neo4 or R1 or M4), the Olimex Olinuxino-A64, and the Rock Pi 4, all come with an onboard RTC installed. So some single board computer ARM devices do have them built-in, while others do not. +For example, the Raspberry Pi (a.k.a. the most common and popular single board computer on the planet) cannot seem to factor-in an onboard timekeeper within its MSRP, even on the more expensive models which feature larger amounts of RAM but still no RTC. The Banana Pi, Orange Pi, and Asus Tinkerboard devices do not feature an onboard RTC. Less common devices, such as SolidRun's HummingBoard Pro, the NanoPi (Neo4 or R1 or M4), the Olimex Olinuxino-A64, and the Rock Pi 4, all come with an onboard RTC installed. So some single board computer ARM devices do have them built-in, while others do not. 
  
 On those which don't have a RTC as standard it's prudent, and easily affordable, to buy a RTC module and install it yourself, with some [[https://www.ebay.com/sch/i.html?_from=R40&_nkw=RTC&_sacat=0&_sop=15|RTCs being available on eBay for only a few dollars]] inc. delivery! On those which don't have a RTC as standard it's prudent, and easily affordable, to buy a RTC module and install it yourself, with some [[https://www.ebay.com/sch/i.html?_from=R40&_nkw=RTC&_sacat=0&_sop=15|RTCs being available on eBay for only a few dollars]] inc. delivery!
Line 37: Line 37:
 The quickest and laziest method is with the Bash script code below, which is a representation of an '/etc/rc.d/rc.local' file which will set the system date/time on boot-up and also set the date/time on an installed RTC. Everything is done //automagically// and is effortless... The quickest and laziest method is with the Bash script code below, which is a representation of an '/etc/rc.d/rc.local' file which will set the system date/time on boot-up and also set the date/time on an installed RTC. Everything is done //automagically// and is effortless...
  
-<file sh rc.local.sh>+<file sh rc.local>
 #!/bin/sh #!/bin/sh
 # #
Line 72: Line 72:
 I've got this code in the '/etc/rc.d/rc.local' initialisation script on all my ARM devices. It does a remarkably good job and has never failed. This code works when there's no Internet connection because all my ARM devices also have a battery backed-up [DS3231] RTC installed. So, either way, my system is going to have the date and time set by one means or other. Although in reality, I've never seen the error message appear anywhere. Even when the battery depleted on a ChronoDot RTC that I've had for +9 years this script got the date and time from my local network's NTP server anyway. Instead of specifying an Internet-based NTP server (e.g. 0.pool.ntp.org), I have my scripts query the IP address of an NTP server (e.g. 192.168.1.17 on port 123) on my local network, which I have running on one of my Raspberry Pi 2 devices.  I've got this code in the '/etc/rc.d/rc.local' initialisation script on all my ARM devices. It does a remarkably good job and has never failed. This code works when there's no Internet connection because all my ARM devices also have a battery backed-up [DS3231] RTC installed. So, either way, my system is going to have the date and time set by one means or other. Although in reality, I've never seen the error message appear anywhere. Even when the battery depleted on a ChronoDot RTC that I've had for +9 years this script got the date and time from my local network's NTP server anyway. Instead of specifying an Internet-based NTP server (e.g. 0.pool.ntp.org), I have my scripts query the IP address of an NTP server (e.g. 192.168.1.17 on port 123) on my local network, which I have running on one of my Raspberry Pi 2 devices. 
  
 +===== Setting the system time with a local NTP server =====
 +
 +The SlackDocs [[howtos:network_services:ntp|NTP]] page takes users through the process of how to configure and maintain a Slackware NTP server. It's a very easy and straight-forward exercise. So, if you have an ARM device just laying around, gathering dust or not doing much, it might be advantageous to put it to some use for this purpose. 
 +
 +Once you have a NTP server running on your local network, you are able to set any other computer system or device that uses a time protocol from it; Linux systems, Windows computers, Android devices, tablets, smart phones, etc. Therefore, it's possible to have everything set with an accurate date and time that's capable of communicating with the NTP server. 
 +
 +Setting the date and time on other Slackware [Linux] systems using a local network NTP server is achieved by typing one simple command:
 +
 +<code>
 +~# sntp -Ss 192.168.1.17
 +</code>
 +
 +On Slackware ARM 14.2 this can be achieved using the following command:
 +
 +<code>
 +~# ntpdate 192.168.1.17
 +</code>
 +
 +In the example above, the IP address is our local network NTP server machine. Obviously you would enter the IP address of the machine running the NTP server daemon on your own local network.
 ====== Help ====== ====== Help ======
  
 Any requests for help/assitance, questions, suggestions, good or bad or indifferent feedback, can be addressed on the [[https://www.linuxquestions.org/questions/slackware-arm-108|Slackware ARM LQ forum]]. Any requests for help/assitance, questions, suggestions, good or bad or indifferent feedback, can be addressed on the [[https://www.linuxquestions.org/questions/slackware-arm-108|Slackware ARM LQ forum]].
  
-Thank you for being interested in automatically setting the system date and time on a Slackware ARM installed device, and in this SlackDoc page.+Thank you for being interested in automatically setting the system date and time on a Slackware ARM installed device, and in this SlackDocs page.
  
 ====== Sources ====== ====== Sources ======
 # Documentation which assisted in this SlackDoc project: # Documentation which assisted in this SlackDoc project:
  
-TODO+https://docs.slackware.com/howtos:network_services:ntp - by [[wiki:user:kikinovak|Niki Kovacs]]
  
 <!-- If you are copying information from another source, then specify that source --> <!-- If you are copying information from another source, then specify that source -->
 howtos:hardware:arm:automatically_setting_system_time_on_arm_devices ()