Skip to content

Instantly share code, notes, and snippets.

@denisdemaisbr
Created August 24, 2024 06:36
Show Gist options
  • Save denisdemaisbr/85fd108dd2d010cd7dd1c0c03821d520 to your computer and use it in GitHub Desktop.
Save denisdemaisbr/85fd108dd2d010cd7dd1c0c03821d520 to your computer and use it in GitHub Desktop.
ubuntu 20.x ntpd ntp timesyncd timesync br
#!/bin/bash
# ******************** #
# use it own your risk #
# ******************** #
# checkotu: https://ntp.br/guia/linux/ #
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit 1
fi
exit 0
apt-get -y update
apt-get install systemd-timesyncd
# timedatectl list-timezones
# timedatectl set-timezone America/Sao_Paulo
cp /etc/systemd/timesyncd.conf /etc/systemd/timesyncd.conf.bak
echo "[Time]" > /etc/systemd/timesyncd.conf
echo "NTP=NTP=a.st1.ntp.br b.st1.ntp.br c.st1.ntp.br d.st1.ntp.br gps.ntp.br a.ntp.br b.ntp.br c.ntp.br" >> /etc/systemd/timesyncd.conf
timedatectl set-ntp true
service systemd-timesyncd restart
timedatectl show-timesync
timedatectl status
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment