diff options
author | Derek Jennings <djennings@mageia.org> | 2013-08-27 15:33:27 +0100 |
---|---|---|
committer | Derek Jennings <djennings@mageia.org> | 2013-08-27 15:33:27 +0100 |
commit | d8d2234ca5d91b7344266396927effda4a20ea68 (patch) | |
tree | b6eefd2927d68331338bb71f4d357d4412721478 /common/Wizcommon.pm | |
parent | dbca05ddf77e5188f8b2e3f91c311a6bf258015a (diff) | |
download | drakwizard-d8d2234ca5d91b7344266396927effda4a20ea68.tar drakwizard-d8d2234ca5d91b7344266396927effda4a20ea68.tar.gz drakwizard-d8d2234ca5d91b7344266396927effda4a20ea68.tar.bz2 drakwizard-d8d2234ca5d91b7344266396927effda4a20ea68.tar.xz drakwizard-d8d2234ca5d91b7344266396927effda4a20ea68.zip |
fix race condition checking service status (mga#10934)
Diffstat (limited to 'common/Wizcommon.pm')
-rw-r--r-- | common/Wizcommon.pm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/common/Wizcommon.pm b/common/Wizcommon.pm index 5caa0766..34a94f48 100644 --- a/common/Wizcommon.pm +++ b/common/Wizcommon.pm @@ -28,7 +28,7 @@ use MDK::Common; use MDK::Wizard::IFCFG; our @ISA = qw(Exporter); -our @EXPORT = qw(check_started check_starts_on_boot test_host_domain); +our @EXPORT = qw(check_started check_starts_on_boot test_host_domain reload_or_restart); sub check_dhcp { my ($wiz) = @_; @@ -48,6 +48,15 @@ sub check_started { return 'error_end' if !$isrunning; } +sub reload_or_restart { + my ($service) = @_; + if (run_program::rooted($::prefix, '/bin/mountpoint', '-q', '/sys/fs/cgroup/systemd')) { + run_program::rooted($::prefix, '/bin/systemctl', 'reload-or-restart', "$service.service"); + } else { + run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", "restart"); + } +} + sub check_starts_on_boot($$) { my ($in, $servicename) = @_; if (!services::starts_on_boot($servicename)) { |