summaryrefslogtreecommitdiffstats
path: root/time_wizard
diff options
context:
space:
mode:
Diffstat (limited to 'time_wizard')
-rw-r--r--time_wizard/Ntp.pm18
1 files changed, 8 insertions, 10 deletions
diff --git a/time_wizard/Ntp.pm b/time_wizard/Ntp.pm
index 4f76504a..c754a833 100644
--- a/time_wizard/Ntp.pm
+++ b/time_wizard/Ntp.pm
@@ -199,18 +199,16 @@ sub do_it {
my $file = "/etc/sysconfig/clock";
!-f "$file.orig" and MDK::Common::cp_af($file, $file . ".orig");
local *NEW;
- open(NEW, "> $file") or die "can not open $file: $!";
- print NEW "UTC=true\n";
- print NEW "ZONE=$o->{var}{wiz_timezone}\n";
- print NEW "ARC=false\n";
- close NEW or die "can not close $file: $!";
+ output($file, qq(UTC=true
+ZONE=$o->{var}{wiz_timezone}
+ARC=false
+));
-f "/usr/share/zoneinfo/$o->{var}{wiz_timezone}" and MDK::Common::cp_af("/usr/share/zoneinfo/$o->{var}{wiz_timezone}", "/etc/localtime");
-f "/etc/ntp/step-tickers" and MDK::Common::cp_af("/etc/ntp/step-tickers", "/etc/ntp/step-tickers.orig");
- open(NEW, "> /etc/ntp/step-tickers") or die "can not open /etc/ntp/step-tickers: $!";
- print NEW $o->{var}{varserver1} . "\n";
- print NEW $o->{var}{varserver2} . "\n";
- print NEW $o->{var}{varserver3} . "\n";
- close NEW or die "can not close /etc/ntp/step-tickers: $!";
+ output('/etc/ntp/step-tickers', join("\n", $o->{var}{varserver1},
+ $o->{var}{varserver2},
+ $o->{var}{varserver3},
+ undef));
substInFile { s/(# server clock.via.net)/$1\nserver $o->{var}{varserver1}/ } '/etc/ntp.conf' if -f '/etc/ntp.conf';
standalone::explanations("Wrote /etc/ntp/step-tickers, starting services");
my $command = "service crond stop; service atd stop; service ntpd stop; service ntpd start; service atd start; service crond start; /sbin/hwclock --systohc --utc";