diff options
-rw-r--r-- | time_wizard/Ntp.pm | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/time_wizard/Ntp.pm b/time_wizard/Ntp.pm index b7dd9f31..f666944e 100644 --- a/time_wizard/Ntp.pm +++ b/time_wizard/Ntp.pm @@ -26,6 +26,7 @@ use strict; use common; use services; +use MDK::Wizard::Wizcommon; require MDK::Wizard::Wizcommon; my $wiz = new MDK::Wizard::Wizcommon; @@ -183,16 +184,19 @@ sub get_timezone { } sub test { - if ($::testing) { - do_it(); - return 'end'; - } - system("/usr/sbin/ntpdate -q $o->{var}{varserver1} $o->{var}{varserver2}"); - if (!($? >> 8)) { - do_it(); - return 'end' - } - 'server_not_responding' + if ($::testing) { + do_it(); + return 'end'; + } + my $command = "/usr/sbin/ntpdate -q $o->{var}{varserver1}"; # $o->{var}{varserver2}"; + my $o = wizard_progress_bar($command, "Test NTP server Responding..."); + $o; + # system("/usr/sbin/ntpdate -q $o->{var}{varserver1} $o->{var}{varserver2}"); + if (!($? >> 8)) { + do_it(); + return 'end' + } + 'server_not_responding' } sub do_it { @@ -217,16 +221,8 @@ sub do_it { close NEW or die "can not close /etc/ntp/step-tickers: $!"; 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 @services = qw(crond atd ntpd); - foreach (@services) { - if (services::is_service_running($_)) { - services::stop($_) - } - } - foreach (reverse @services) { - services::start($_) - } - system("/sbin/hwclock --systohc --utc"); + my $command = "service crond stop; service atd stop; service ntpd stop; service ntpd start; service atd start; service crond start; /sbin/hwclock --systohc --utc"; + wizard_progress_bar($command, "Configuring NTP, ATD and CROND services..."); } 1; |