diff options
author | Angelo Naselli <anaselli@linux.it> | 2016-05-05 22:32:46 +0200 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2016-05-05 22:32:46 +0200 |
commit | 3092a85563c21fc857dc58019e8df564fa8e21cc (patch) | |
tree | 70ce453c6088a4117ada8cd913f1ca91b8d592f4 | |
parent | b8b3eda6e3eb2b42ff94ff00882591627820c538 (diff) | |
download | manatools-3092a85563c21fc857dc58019e8df564fa8e21cc.tar manatools-3092a85563c21fc857dc58019e8df564fa8e21cc.tar.gz manatools-3092a85563c21fc857dc58019e8df564fa8e21cc.tar.bz2 manatools-3092a85563c21fc857dc58019e8df564fa8e21cc.tar.xz manatools-3092a85563c21fc857dc58019e8df564fa8e21cc.zip |
fixed disabling and enabling legacy services (github isse 3)
-rw-r--r-- | lib/ManaTools/Shared/Services.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ManaTools/Shared/Services.pm b/lib/ManaTools/Shared/Services.pm index 686e4584..785b828d 100644 --- a/lib/ManaTools/Shared/Services.pm +++ b/lib/ManaTools/Shared/Services.pm @@ -393,10 +393,14 @@ sub set_service { my @xinetd_services = map { $_->[0] } $self->xinetd_services(); + # NOTE EnableUnitFiles and DisableUnitFiles don't work with legacy services + # and return file not found + my $legacy = -e "/etc/rc.d/init.d/$service"; + if (MDK::Common::DataStructure::member($service, @xinetd_services)) { $ENV{PATH} = "/usr/bin:/usr/sbin"; ManaTools::Shared::RunProgram::rooted("", "/usr/sbin/chkconfig", $enable ? "--add" : "--del", $service); - } elsif ($self->_running_systemd() || $self->_has_systemd()) { + } elsif (!$legacy && ($self->_running_systemd() || $self->_has_systemd())) { $service = $service . ".service"; my $dbus_object = $self->dbus_systemd1_object; if ($enable) { |