From e55b344a4b541d1c6d3f4a7589d37defc4a8efb2 Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Thu, 26 Jun 2014 11:31:51 +0200 Subject: Added isNTPRunning --- lib/AdminPanel/Shared/TimeZone.pm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'lib/AdminPanel/Shared') diff --git a/lib/AdminPanel/Shared/TimeZone.pm b/lib/AdminPanel/Shared/TimeZone.pm index 1af65086..971ea94b 100644 --- a/lib/AdminPanel/Shared/TimeZone.pm +++ b/lib/AdminPanel/Shared/TimeZone.pm @@ -57,6 +57,7 @@ use Moose; use DateTime::TimeZone; use Config::Auto; use AdminPanel::Shared::Locales; +use AdminPanel::Shared::Services; use MDK::Common::File; use MDK::Common::Func; @@ -441,6 +442,27 @@ sub ntpCurrentServer { MDK::Common::Func::find { $_ ne '127.127.1.0' } map { MDK::Common::Func::if_(/^\s*server\s+(\S*)/, $1) } MDK::Common::File::cat_($self->ntp_configuration_file); } +#============================================================= + +=head2 isNTPRunning + +=head3 DESCRIPTION + + This method just returns if the given ntp server is running + +=cut + +#============================================================= + +sub isNTPRunning { + my$self = shift; + + # TODO is that valid for any ntp program? adding ntp_service_name parameter + my $ntpd = $self->ntp_program . 'd'; + + return !AdminPanel::Shared::Services::is_service_running($ntpd); +} + no Moose; __PACKAGE__->meta->make_immutable; -- cgit v1.2.1