summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Jennings <djennings@mageia.org>2013-08-27 11:57:04 +0100
committerDerek Jennings <djennings@mageia.org>2013-08-27 11:57:04 +0100
commit0d40a86deb661105949fd78ad74dc7554697094e (patch)
treef940075496bf4dc69e9502e579a5a7386e104bfa
parentb66bff3521685687b0fb40995d46aa46a3b0f44e (diff)
downloaddrakwizard-0d40a86deb661105949fd78ad74dc7554697094e.tar
drakwizard-0d40a86deb661105949fd78ad74dc7554697094e.tar.gz
drakwizard-0d40a86deb661105949fd78ad74dc7554697094e.tar.bz2
drakwizard-0d40a86deb661105949fd78ad74dc7554697094e.tar.xz
drakwizard-0d40a86deb661105949fd78ad74dc7554697094e.zip
fix race condition checking service status (mga#10830)
-rw-r--r--NEWS2
-rw-r--r--common/Wizcommon.pm11
-rwxr-xr-xdhcp_wizard/Dhcp.pm2
-rw-r--r--dns_wizard/Bind.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
8 files changed, 18 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 87d7cbf0..db6013b5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- fix race condition checking service status (mga#10830)
+
Version 3.7.5 - 27 May 2011, by Ennael
- clean Mandriva references
diff --git a/common/Wizcommon.pm b/common/Wizcommon.pm
index 7e58107a..2fe045d0 100644
--- a/common/Wizcommon.pm
+++ b/common/Wizcommon.pm
@@ -27,7 +27,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);
my $net;
@@ -51,6 +51,15 @@ sub check_started {
}
}
+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 8a02bba6..c4bfb2bc 100755
--- a/dhcp_wizard/Dhcp.pm
+++ b/dhcp_wizard/Dhcp.pm
@@ -269,7 +269,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/dns_wizard/Bind.pm b/dns_wizard/Bind.pm
index cd4bdf2a..9a13e7cb 100644
--- a/dns_wizard/Bind.pm
+++ b/dns_wizard/Bind.pm
@@ -822,7 +822,7 @@ sub end_it {
save_old_config();
# copy in correct place
copy_good();
- services::restart_or_start('named');
+ reload_or_restart('named');
}
sub do_it_master {
diff --git a/ftp_wizard/Proftpd.pm b/ftp_wizard/Proftpd.pm
index d3671348..d7b2e81d 100755
--- a/ftp_wizard/Proftpd.pm
+++ b/ftp_wizard/Proftpd.pm
@@ -316,7 +316,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 25bc8b16..72e0fdd7 100755
--- a/proxy_wizard/Squid.pm
+++ b/proxy_wizard/Squid.pm
@@ -288,7 +288,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 a560729e..ba9bb8db 100755
--- a/sshd_wizard/Sshd.pm
+++ b/sshd_wizard/Sshd.pm
@@ -213,7 +213,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 62ca5ed8..496a4f44 100755
--- a/web_wizard/Apache.pm
+++ b/web_wizard/Apache.pm
@@ -272,7 +272,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});
}