Skip to content

Commit 34e5797

Browse files
committed
Replace ntpdate with systemd's timesyncd
Previously NTP was setup via ntpdate which resulted in a situation on most systemd installations where NTP was effectively being setup twice because timesyncd is usually enabled by default. This effectively renders setting up ntpdate redundant as what it does is already done by timesyncd. Being that Hestia only supports systemd installations the most logical resolution is to replace ntpdate with timesyncd setup during installation. That is what I try to do here.
1 parent 8c3d792 commit 34e5797

File tree

2 files changed

+9
-25
lines changed

2 files changed

+9
-25
lines changed

install/hst-install-debian.sh

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ if [ "$release" -eq 9 ]; then
4141
dovecot-pop3d roundcube-core net-tools roundcube-mysql roundcube-plugins
4242
mariadb-client mariadb-common mariadb-server postgresql
4343
postgresql-contrib phppgadmin phpmyadmin mc flex whois rssh git idn zip
44-
sudo bc ftp lsof ntpdate rrdtool quota e2fslibs bsdutils e2fsprogs curl
44+
sudo bc ftp lsof rrdtool quota e2fslibs bsdutils e2fsprogs curl
4545
imagemagick fail2ban dnsutils bsdmainutils cron hestia hestia-nginx
4646
hestia-php expect libmail-dkim-perl unrar-free vim-common acl sysstat
4747
rsyslog ssh setpriv ipset libapache2-mod-ruid2"
@@ -57,7 +57,7 @@ elif [ "$release" -eq 10 ]; then
5757
clamav-daemon spamassassin dovecot-imapd dovecot-pop3d roundcube-core
5858
net-tools roundcube-mysql roundcube-plugins mariadb-client
5959
mariadb-common mariadb-server postgresql postgresql-contrib phpmyadmin
60-
phppgadmin mc flex whois git idn zip sudo bc ftp lsof ntpdate rrdtool
60+
phppgadmin mc flex whois git idn zip sudo bc ftp lsof rrdtool
6161
quota e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils
6262
bsdmainutils cron hestia hestia-nginx hestia-php expect
6363
libmail-dkim-perl unrar-free vim-common acl sysstat rsyslog ssh util-linux
@@ -310,13 +310,6 @@ apt-get -qq update
310310
# Creating backup directory
311311
mkdir -p $hst_backups
312312

313-
# Checking ntpdate
314-
if [ ! -e '/usr/sbin/ntpdate' ]; then
315-
echo "[ * ] Installing ntpdate..."
316-
apt-get -y install ntpdate >> $LOG
317-
check_result $? "Can't install ntpdate"
318-
fi
319-
320313
# Checking wget
321314
if [ ! -e '/usr/bin/wget' ]; then
322315
echo "[ * ] Installing wget..."
@@ -965,10 +958,9 @@ if [ -z "$(grep ^/usr/sbin/nologin /etc/shells)" ]; then
965958
fi
966959

967960
# Configuring NTP
968-
echo '#!/bin/sh' > /etc/cron.daily/ntpdate
969-
echo "$(which ntpdate) -s pool.ntp.org" >> /etc/cron.daily/ntpdate
970-
chmod 755 /etc/cron.daily/ntpdate
971-
ntpdate -s pool.ntp.org
961+
sed -i 's/#NTP=/NTP=pool.ntp.org/' /etc/systemd/timesyncd.conf
962+
systemctl enable systemd-timesyncd
963+
systemctl start systemd-timesyncd
972964

973965
# Setup rssh
974966
if [ ! "$release" -eq 10 ]; then

install/hst-install-ubuntu.sh

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ software="apache2 apache2.2-common apache2-suexec-custom apache2-utils
3535
cron curl dnsutils dovecot-imapd dovecot-pop3d e2fslibs e2fsprogs exim4
3636
exim4-daemon-heavy expect fail2ban flex ftp git idn imagemagick
3737
libapache2-mod-fcgid libapache2-mod-php$fpm_v libapache2-mod-rpaf
38-
lsof mc mariadb-client mariadb-common mariadb-server nginx ntpdate
38+
lsof mc mariadb-client mariadb-common mariadb-server nginx
3939
php$fpm_v php$fpm_v-cgi php$fpm_v-common php$fpm_v-curl phpmyadmin
4040
php$fpm_v-mysql php$fpm_v-imap php$fpm_v-ldap php$fpm_v-apcu phppgadmin
4141
php$fpm_v-pgsql php$fpm_v-zip php$fpm_v-bz2 php$fpm_v-cli php$fpm_v-gd
@@ -292,13 +292,6 @@ apt-get -qq update
292292
# Creating backup directory
293293
mkdir -p $hst_backups
294294

295-
# Checking ntpdate
296-
if [ ! -e '/usr/sbin/ntpdate' ]; then
297-
echo "[ * ] Installing ntpdate..."
298-
apt-get -y install ntpdate >> $LOG
299-
check_result $? "Can't install ntpdate"
300-
fi
301-
302295
# Checking wget
303296
if [ ! -e '/usr/bin/wget' ]; then
304297
echo "[ * ] Installing wget..."
@@ -959,10 +952,9 @@ if [ -z "$(grep nologin /etc/shells)" ]; then
959952
fi
960953

961954
# Configuring NTP
962-
echo '#!/bin/sh' > /etc/cron.daily/ntpdate
963-
echo "$(which ntpdate) -s pool.ntp.org" >> /etc/cron.daily/ntpdate
964-
chmod 755 /etc/cron.daily/ntpdate
965-
ntpdate -s pool.ntp.org
955+
sed -i 's/#NTP=/NTP=pool.ntp.org/' /etc/systemd/timesyncd.conf
956+
systemctl enable systemd-timesyncd
957+
systemctl start systemd-timesyncd
966958

967959
# Setup rssh
968960
if [ "$release" != '20.04' ]; then

0 commit comments

Comments
 (0)