summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Jennings <djennings@mageia.org>2013-08-27 15:33:27 +0100
committerDerek Jennings <djennings@mageia.org>2013-08-27 15:33:27 +0100
commitd8d2234ca5d91b7344266396927effda4a20ea68 (patch)
treeb6eefd2927d68331338bb71f4d357d4412721478
parentdbca05ddf77e5188f8b2e3f91c311a6bf258015a (diff)
downloaddrakwizard-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)
-rw-r--r--NEWS2
-rw-r--r--common/Wizcommon.pm11
-rwxr-xr-xdhcp_wizard/Dhcp.pm2
-rwxr-xr-xftp_wizard/Proftpd.pm2
-rwxr-xr-xproxy_wizard/Squid.pm2
-rwxr-xr-xsshd_wizard/Sshd.pm2
-rwxr-xr-xweb_wizard/Apache.pm2
7 files changed, 17 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index 3259f5b5..9f9d4c23 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- fix race condition checking service status (mga#10934)
+
Version 3.9 - 21 Apr 2013, by Thierry Vignaud
- FTP:
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)) {
diff --git a/dhcp_wizard/Dhcp.pm b/dhcp_wizard/Dhcp.pm
index e8411f52..4f83b478 100755
--- a/dhcp_wizard/Dhcp.pm
+++ b/dhcp_wizard/Dhcp.pm
@@ -261,7 +261,7 @@ mask = $wiz_ip_netmask, rng1 = $wiz_ip_range1, rng2 = $wiz_ip_range2, dname = $w
s/#\s+doption routers.*//;
} "/etc/dhcpd.conf";
- services::restart_or_start('dhcpd');
+ reload_or_restart('dhcpd');
check_started('dhcpd');
}
diff --git a/ftp_wizard/Proftpd.pm b/ftp_wizard/Proftpd.pm
index b2afda55..22695c4e 100755
--- a/ftp_wizard/Proftpd.pm
+++ b/ftp_wizard/Proftpd.pm
@@ -317,7 +317,7 @@ sub do_it {
add_options($cle, $val);
}
- services::restart_or_start('proftpd');
+ reload_or_restart('proftpd');
check_started('proftpd');
}
diff --git a/proxy_wizard/Squid.pm b/proxy_wizard/Squid.pm
index 662974fc..f46091af 100755
--- a/proxy_wizard/Squid.pm
+++ b/proxy_wizard/Squid.pm
@@ -278,7 +278,7 @@ level = $o->{var}{wiz_squid_level}");
} $file;
system("/sbin/chkconfig --level 345 squid on");
- services::restart_or_start('squid');
+ reload_or_restart('squid');
undef $w;
check_started('squid');
}
diff --git a/sshd_wizard/Sshd.pm b/sshd_wizard/Sshd.pm
index 99c524cd..e86a4028 100755
--- a/sshd_wizard/Sshd.pm
+++ b/sshd_wizard/Sshd.pm
@@ -214,7 +214,7 @@ sub new {
sub write_conf_restart_ssh {
$sshd->write_conf($conf);
- services::restart_or_start('sshd');
+ reload_or_restart('sshd');
}
sub global_config {
diff --git a/web_wizard/Apache.pm b/web_wizard/Apache.pm
index 79395930..a2db5da5 100755
--- a/web_wizard/Apache.pm
+++ b/web_wizard/Apache.pm
@@ -271,7 +271,7 @@ sub do_it {
chg_docroot();
chg_user_dir();
- services::restart_or_start('httpd');
+ reload_or_restart('httpd');
undef $w;
check_started($o->{var}{servicecheck});
}