You've already forked ntp-client-ubuntu
comment corrections only no code changes
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# Author : Allan Christensen
|
||||
# First Created : 05012022 (DD-MM-YYYY)
|
||||
# Description : Installs Ntp client on Ubuntu 24.04
|
||||
# Description : Installs NTP client on Ubuntu 24.04
|
||||
# License : MIT License (see LICENSE file for details)
|
||||
|
||||
#
|
||||
@@ -17,12 +16,12 @@ if [[ $(id -u) -ne 0 ]]; then echo "" && echo "Must be root or use sudo" && echo
|
||||
apt install -y ntp ntpdate && systemctl enable ntp
|
||||
|
||||
#
|
||||
# Disable systemd-timesyncd NTP
|
||||
# Disable systemd-timesyncd NTP service
|
||||
#
|
||||
timedatectl set-ntp off
|
||||
|
||||
#
|
||||
# Sync time once
|
||||
# Synchronize time once
|
||||
#
|
||||
ntpdate -u 0.pool.ntp.org
|
||||
|
||||
@@ -42,9 +41,9 @@ if [ -f /etc/ntpsec/ntp.conf ]; then conf_file="/etc/ntpsec/ntp.conf" ; fi
|
||||
#
|
||||
backup_file="${conf_file}.bak"; cp "$conf_file" "$backup_file"
|
||||
|
||||
#
|
||||
#
|
||||
# Define NTP servers
|
||||
#
|
||||
#
|
||||
ntp_servers="server 0.pool.ntp.org
|
||||
server 1.pool.ntp.org
|
||||
server 2.pool.ntp.org
|
||||
@@ -56,10 +55,13 @@ server 3.pool.ntp.org"
|
||||
sed -i '/pool.ntp.org/ s/^/# /g' "$conf_file"
|
||||
|
||||
#
|
||||
# Add the new defined servers
|
||||
# Add the newly defined servers
|
||||
#
|
||||
tmp_file="/tmp/ntpconf" ; printf "%s\n" "$ntp_servers" > "$tmp_file"
|
||||
|
||||
# Insert after a line containing "Specify one" if it exists else append at the end
|
||||
#
|
||||
# Insert after a line containing 'Specify one' if it exists, otherwise append at the end
|
||||
#
|
||||
if grep -q "Specify one" "$conf_file"; then
|
||||
sed -i "/Specify one/r $tmp_file" "$conf_file"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user