summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-10-17 17:18:40 +0000
committerThierry Vignaud <tv@mageia.org>2012-10-17 17:18:40 +0000
commit108c9ad989aeeff143bebf230946a50ae5e8ae3e (patch)
tree2a9a4074cb511ed13987785ecd9bdfa42a8b8361
parent32be07bcf5253e7f321dccd2efd40b5fffb1011c (diff)
downloaddrakwizard-108c9ad989aeeff143bebf230946a50ae5e8ae3e.tar
drakwizard-108c9ad989aeeff143bebf230946a50ae5e8ae3e.tar.gz
drakwizard-108c9ad989aeeff143bebf230946a50ae5e8ae3e.tar.bz2
drakwizard-108c9ad989aeeff143bebf230946a50ae5e8ae3e.tar.xz
drakwizard-108c9ad989aeeff143bebf230946a50ae5e8ae3e.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 f37fed2e..b6c47232 100755
--- a/client_wizard/Bind_client.pm
+++ b/client_wizard/Bind_client.pm
@@ -167,11 +167,7 @@ sub do_it {
MDK::Common::cp_af($file, $file . ".orig");
append_to_file($file, "\n$dc IN PTR $o->{var}{client_name}. ; $date\n\n");
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 526aac54..72a413f1 100755
--- a/dhcp_wizard/Dhcp.pm
+++ b/dhcp_wizard/Dhcp.pm
@@ -266,11 +266,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 77eed5bf..3bd71e8b 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 2c2fd2fd..90354a45 100755
--- a/ftp_wizard/Proftpd.pm
+++ b/ftp_wizard/Proftpd.pm
@@ -323,11 +323,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 e938d2d3..f6bfa84d 100755
--- a/proxy_wizard/Squid.pm
+++ b/proxy_wizard/Squid.pm
@@ -282,11 +282,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 cfffc9a2..cac703d8 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 12d4687f..8fea5014 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});
}