initial commit of file from CVS for e-smith-ntp on Wed 12 Jul 09:00:21 BST 2023

This commit is contained in:
Brian Read
2023-07-12 09:00:21 +01:00
parent 59f5643b62
commit 4d143a42fe
37 changed files with 3230 additions and 2 deletions

View File

@@ -0,0 +1,8 @@
/var/log/ntp.log \{
missingok
weekly
rotate 24
compress
notifempty
copytruncate
\}

View File

@@ -0,0 +1,19 @@
{
# vim: ft=perl:
my $server = $ntpd{NTPServer} || '';
return "# sync to hw clock" if $server =~ m#^\s*$#;
if ( ($ntpd{'SupportLargeDrift'} || 'disabled') eq 'enabled' ){
$OUT .= "tinker panic 0\n";
}
if ($server =~ /pool.ntp.org/)
{
# The 0, 1, 2, 3 prefixes ensure NTP pool round-robin
$OUT .= "server $_.$server\n" for (0..3);
}
else
{
$OUT .= "server $server\n";
}
}

View File

@@ -0,0 +1,9 @@
{
$OUT = '';
unless ( ($ntpd{'SupportLargeDrift'} || 'disabled') eq 'enabled' ){
$OUT .= <<EOF;
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
EOF
}
}

View File

@@ -0,0 +1,3 @@
{
$OUT = "driftfile /var/lib/ntp/drift";
}

View File

@@ -0,0 +1,2 @@
restrict default noquery

View File

@@ -0,0 +1 @@
restrict 127.0.0.1

View File

@@ -0,0 +1,19 @@
{
my $NTPenabled = $ntpd{'status'} || 'disabled';
my $server = $ntpd{NTPServer} || '';
if ($NTPenabled eq 'enabled')
{
if ($server =~ /pool.ntp.org/)
{
$OUT .= "0.$server";
}
else
{
$OUT .= "$server";
}
}
else
{
$OUT .= "# ntpd service is disabled";
}
}

View File

@@ -0,0 +1,4 @@
#ntp
:programname, isequal, "ntpd" /var/log/ntp.log
& stop

View File

@@ -0,0 +1,5 @@
{
my $timezone = $TimeZone || "US/Eastern";
$OUT .= "ZONE=\"$timezone\"";
}

View File

@@ -0,0 +1,3 @@
{
$OUT .= "UTC=true";
}

View File

@@ -0,0 +1,3 @@
{
$OUT .= "ARC=false";
}

View File

@@ -0,0 +1,4 @@
# nut ntpd specific subservices
# this would conflict with ntpd
disable ntpdate.service

View File

@@ -0,0 +1,20 @@
[Service]
{
# memory limit to catch any memory leak before it kills the system
use constant MIN_MEMORY_LIMIT => 35000000;
# If there is a memory limit in the database and it is below the minimum, delete it.
if (defined $ntpd{MemLimit} && $ntpd{MemLimit} < MIN_MEMORY_LIMIT)
{
$DB->get_prop_and_delete('ntpd','MemLimit');
delete $ntpd{MemLimit};
}
$OUT .= "MemoryLimit=";
$OUT .= $ntpd{MemLimit} || MIN_MEMORY_LIMIT;
$OUT .= "\n";
}
ExecStartPre=-/sbin/e-smith/expand-template /etc/ntp.conf
ExecStartPre=-/sbin/e-smith/systemd/initializedate
Restart=always

View File

@@ -0,0 +1,2 @@
[Install]
WantedBy=sme-server.target