summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDerek Jennings <derekjenn@gmail.com>2013-08-27 00:59:13 +0100
committerDerek Jennings <derekjenn@gmail.com>2013-08-27 00:59:13 +0100
commit3916cbf9575d4b4db015fd629fdcaf395724cd9c (patch)
tree848bd6365f8c8d123f14a0bc12dd91c0d6e9dafc /common
parent6a7e38b9afdb0550195c0219ddccd83839c368c0 (diff)
downloaddrakwizard-3916cbf9575d4b4db015fd629fdcaf395724cd9c.tar
drakwizard-3916cbf9575d4b4db015fd629fdcaf395724cd9c.tar.gz
drakwizard-3916cbf9575d4b4db015fd629fdcaf395724cd9c.tar.bz2
drakwizard-3916cbf9575d4b4db015fd629fdcaf395724cd9c.tar.xz
drakwizard-3916cbf9575d4b4db015fd629fdcaf395724cd9c.zip
fix race condition checking service status (mga#10934)
Diffstat (limited to 'common')
-rw-r--r--common/Wizcommon.pm11
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)) {