Files
init.sh/modules/conf_ntp.sh

37 lines
704 B
Bash

# NTP
export VER_conf_ntp="0.0.2"
conf_ntp()
{
prnt I "Arrêt du service ntp..."
svc_stop ntp
prnt I "Installation du fichier de configuration de NTP."
dest="/etc/ntp.conf.work"
backupdist /etc/ntp.conf
installfile ntp.conf $dest
local line=""
for srv in $NTPSERVERS; do
line="${line}server $srv iburst\n"
done
sed -i -e "s/@SERVERLIST@/$line/" $dest &&
echo "# Generated on $(stdtime)" >> $dest &&
mv -fv $dest /etc/ntp.conf
prnt I "Démarrage du service ntp..."
svc_start ntp
}
# NTP
precheck_conf_ntp()
{
if [[ ! $NTPSERVERS ]]; then
prnt E "Pas de serveur NTP configuré !"
exit 1
fi
}
export -f conf_ntp
export -f precheck_conf_ntp