aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ManaTools/Shared/TimeZone.pm
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2015-03-25 12:36:24 +0100
committerAngelo Naselli <anaselli@linux.it>2015-03-25 12:36:24 +0100
commit143675198e9c0fcef3335affa224c6b9799a9a6b (patch)
treec20c6367de27330fd30ade94edee7695b3b626df /lib/ManaTools/Shared/TimeZone.pm
parent7d4134a7fdc5651e90b7aefbda95c5a1998ec3c6 (diff)
downloadcolin-keep-143675198e9c0fcef3335affa224c6b9799a9a6b.tar
colin-keep-143675198e9c0fcef3335affa224c6b9799a9a6b.tar.gz
colin-keep-143675198e9c0fcef3335affa224c6b9799a9a6b.tar.bz2
colin-keep-143675198e9c0fcef3335affa224c6b9799a9a6b.tar.xz
colin-keep-143675198e9c0fcef3335affa224c6b9799a9a6b.zip
fixed isNTPRunning and its test
Diffstat (limited to 'lib/ManaTools/Shared/TimeZone.pm')
-rw-r--r--lib/ManaTools/Shared/TimeZone.pm48
1 files changed, 12 insertions, 36 deletions
diff --git a/lib/ManaTools/Shared/TimeZone.pm b/lib/ManaTools/Shared/TimeZone.pm
index d481bf2..121a123 100644
--- a/lib/ManaTools/Shared/TimeZone.pm
+++ b/lib/ManaTools/Shared/TimeZone.pm
@@ -165,7 +165,7 @@ sub _ntp_program_init {
# looks for a running service from the configured ones,
# if none is running chooses the first of the list
my $list = $self->ntpServiceList();
- return $self->loc->N("No NTP services") if !$list;
+ return "" if !$list;
my $ntpd;
my $isRunning = 0;
@@ -891,43 +891,19 @@ sub isNTPRunning {
my $self = shift;
my $ntpd = $self->ntp_program;
- my $isRunning = $self->sh_services->is_service_running($ntpd);
+ my $isRunning = $ntpd ? $self->sh_services->is_service_running($ntpd) : 0;
if (!$isRunning) {
- my @ntp_service = ("chronyd", "ntpd");
- foreach ( @ntp_service ) {
- $ntpd = $_;
- $isRunning = $self->sh_services->is_service_running($ntpd);
- last if $isRunning;
- }
- if ($isRunning) {
- $self->ntp_program($ntpd);
- if ($ntpd eq "chronyd") {
- $self->ntp_configuration_file("/etc/chrony.conf");
- }
- elsif ($ntpd eq "ntpd") {
- $self->ntp_configuration_file("/etc/ntp.conf");
- }
- }
- else {
- # fallback systemd-timesyncd
-
- if ($self->getEmbeddedNTP()) {
- $ntpd = "systemd-timesyncd";
- $self->ntp_program($ntpd);
- $self->ntp_configuration_file("/etc/systemd/timesyncd.conf");
- $isRunning = $self->sh_services->is_service_running($ntpd);
- # if it is not started you cannot set time with NTP true
- if (!$isRunning) {
- Sys::Syslog::syslog(
- 'info|local1',
- $self->loc->N("%s enabled but stopped - disabling it",
- $ntpd
- )
- );
- $self->setEmbeddedNTP(0);
- }
- }
+ # NOTE fix systemd-timesyncd problem that prevents to set time
+ if ($self->getEmbeddedNTP()) {
+ $ntpd = "systemd-timesyncd";
+ Sys::Syslog::syslog(
+ 'info|local1',
+ $self->loc->N("%s enabled but stopped - disabling it",
+ $ntpd
+ )
+ );
+ $self->setEmbeddedNTP(0);
}
}