Skip to content

Instantly share code, notes, and snippets.

@pandolfipedro
Last active June 24, 2023 00:06
Show Gist options
  • Save pandolfipedro/bd86c12da54c308742d97dc7017bfbfa to your computer and use it in GitHub Desktop.
Save pandolfipedro/bd86c12da54c308742d97dc7017bfbfa to your computer and use it in GitHub Desktop.
Method to update time every boot on orange pi and similar boards.
Get updated time and date from google using:
sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
Then now edit the /etc/rc.local file to update in every boot
sudo nano /etc/rc.local
sudo chmod +x /etc/rc.local
sudo chmod +x /etc/systemd/system/rc-local.service
############ CREATE RC.LOCAL SERVICE ###########
sudo nano /etc/systemd/system/rc-local.service
copy and paste:
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
#### then
sudo systemctl enable rc-local
sudo systemctl start rc-local.service
#### check
sudo systemctl status rc-local.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment