summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-10-17 17:18:40 +0000
committerDerek Jennings <djennings@mageia.org>2013-08-27 11:45:52 +0100
commitb66bff3521685687b0fb40995d46aa46a3b0f44e (patch)
treea787bf4ded01ca77130712ddea4818d4d7a281e8
parent5f19fa5aea36a58c00a7d321a2aaaddde1deeac3 (diff)
downloaddrakwizard-b66bff3521685687b0fb40995d46aa46a3b0f44e.tar
drakwizard-b66bff3521685687b0fb40995d46aa46a3b0f44e.tar.gz
drakwizard-b66bff3521685687b0fb40995d46aa46a3b0f44e.tar.bz2
drakwizard-b66bff3521685687b0fb40995d46aa46a3b0f44e.tar.xz
drakwizard-b66bff3521685687b0fb40995d46aa46a3b0f44e.zip
do not reinvent services::restart_or_start()
-rwxr-xr-xclient_wizard/Bind_client.pm6
-rwxr-xr-xdhcp_wizard/Dhcp.pm6
-rw-r--r--dns_wizard/Bind.pm7
-rwxr-xr-xftp_wizard/Proftpd.pm6
-rwxr-xr-xproxy_wizard/Squid.pm6
-rwxr-xr-xsshd_wizard/Sshd.pm6
-rwxr-xr-xweb_wizard/Apache.pm6
7 files changed, 7 insertions, 36 deletions
diff --git a/client_wizard/Bind_client.pm b/client_wizard/Bind_client.pm
index fc3ddc2a..4770dfd1 100755
--- a/client_wizard/Bind_client.pm
+++ b/client_wizard/Bind_client.pm
@@ -176,11 +176,7 @@ sub do_it {
print NEW "\n$dc IN PTR $o->{var}{client_name}. ; $date\n\n";
close(NEW) or die "can not close $file";
up_serial($file);
- if (services::is_service_running('named')) {
- services::restart('named');
- } else {
- services::start('named');
- }
+ services::restart_or_start('named');
}
sub new {
diff --git a/dhcp_wizard/Dhcp.pm b/dhcp_wizard/Dhcp.pm
index 07a118ac..8a02bba6 100755
--- a/dhcp_wizard/Dhcp.pm
+++ b/dhcp_wizard/Dhcp.pm
@@ -269,11 +269,7 @@ mask = $wiz_ip_netmask, rng1 = $wiz_ip_range1, rng2 = $wiz_ip_range2, dname = $w
s/#\s+doption routers.*//;
} "/etc/dhcpd.conf";
- if (services::is_service_running('dhcpd')) {
- services::restart('dhcpd');
- } else {
- services::start('dhcpd');
- }
+ services::restart_or_start('dhcpd');
check_started('dhcpd');
}
diff --git a/dns_wizard/Bind.pm b/dns_wizard/Bind.pm
index d17570de..cd4bdf2a 100644
--- a/dns_wizard/Bind.pm
+++ b/dns_wizard/Bind.pm
@@ -822,12 +822,7 @@ sub end_it {
save_old_config();
# copy in correct place
copy_good();
- # start or restart the service
- if (services::is_service_running('named')) {
- services::restart('named');
- } else {
- services::start('named');
- }
+ services::restart_or_start('named');
}
sub do_it_master {
diff --git a/ftp_wizard/Proftpd.pm b/ftp_wizard/Proftpd.pm
index e19c2b43..d3671348 100755
--- a/ftp_wizard/Proftpd.pm
+++ b/ftp_wizard/Proftpd.pm
@@ -316,11 +316,7 @@ sub do_it {
add_options($cle, $val);
}
- if (services::is_service_running('proftpd')) {
- services::restart('proftpd');
- } else {
- services::start('proftpd');
- }
+ services::restart_or_start('proftpd');
check_started('proftpd');
}
diff --git a/proxy_wizard/Squid.pm b/proxy_wizard/Squid.pm
index ff9559e2..25bc8b16 100755
--- a/proxy_wizard/Squid.pm
+++ b/proxy_wizard/Squid.pm
@@ -288,11 +288,7 @@ level = $o->{var}{wiz_squid_level}");
} $file;
system("/sbin/chkconfig --level 345 squid on");
- if (services::is_service_running('squid')) {
- services::restart('squid');
- } else {
- services::start('squid');
- }
+ services::restart_or_start('squid');
undef $w;
check_started('squid');
}
diff --git a/sshd_wizard/Sshd.pm b/sshd_wizard/Sshd.pm
index 2e5dec32..a560729e 100755
--- a/sshd_wizard/Sshd.pm
+++ b/sshd_wizard/Sshd.pm
@@ -213,11 +213,7 @@ sub new {
sub write_conf_restart_ssh {
$sshd->write_conf($conf);
- if (services::is_service_running('sshd')) {
- services::restart('sshd');
- } else {
- services::start('sshd');
- }
+ services::restart_or_start('sshd');
}
sub global_config {
diff --git a/web_wizard/Apache.pm b/web_wizard/Apache.pm
index 82f32821..62ca5ed8 100755
--- a/web_wizard/Apache.pm
+++ b/web_wizard/Apache.pm
@@ -272,11 +272,7 @@ sub do_it {
chg_docroot();
chg_user_dir();
- if (services::is_service_running('httpd')) {
- services::restart('httpd');
- } else {
- services::start('httpd');
- }
+ services::restart_or_start('httpd');
undef $w;
check_started($o->{var}{servicecheck});
}