Create a timesync cron job on macOS

Signed-off-by: Thien Tran <contact@tommytran.io>
This commit is contained in:
Thien Tran 2023-08-16 04:43:35 -07:00
parent e14fb3e05a
commit b58a5decf8
No known key found for this signature in database
GPG Key ID: 060B29EB996BD9F2

View File

@ -192,6 +192,22 @@ sntp 127.0.0.1
Once you have verified that everything is working, you can optionally remove the port `22/TCP` forwarding since we will no longer need it. Once you have verified that everything is working, you can optionally remove the port `22/TCP` forwarding since we will no longer need it.
## Create a Synchronization Cron Job
macOS synchronizes time with the NTP server around once every 20 minutes. This can cause the clock to be out of sync for quite awhile when the computer wakes up from sleep, as the NTP server may not have its time corrected by the time macOS makes the first synchronization request.
To work around this, create a cron job to have macOS synchronize time every minute as `root`:
```
sudo crontab -e
```
Add the following:
```
* * * * * /usr/bin/sntp -Ss 127.0.0.1
```
## Automatically start the NTP server at boot ## Automatically start the NTP server at boot
Finally, follow the [official documentation](https://docs.getutm.app/advanced/remote-control/) to automatically start the virtual machine at boot. Finally, follow the [official documentation](https://docs.getutm.app/advanced/remote-control/) to automatically start the virtual machine at boot.