From 25c3cb5e034c42393f92cb68ab7c565779a35890 Mon Sep 17 00:00:00 2001 From: Daouda Lo Date: Thu, 25 Jul 2002 21:23:31 +0000 Subject: - don't display services that are not installed - word wrap string correctly - cleanup --- perl-install/standalone/logdrake | 46 +++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 17 deletions(-) (limited to 'perl-install/standalone') diff --git a/perl-install/standalone/logdrake b/perl-install/standalone/logdrake index 3d9c2b8ab..38bc5c49a 100755 --- a/perl-install/standalone/logdrake +++ b/perl-install/standalone/logdrake @@ -386,18 +386,20 @@ sub log_output { #------------------------------------------------------------- sub alert_config { - + $::isWizard = 1; $::Wizard_pix_up = "wiz_drakgw.png"; # FIXME $::Wizard_title = _("Mail/SMS alert"); - -my $cron =q(#!/usr/bin/perl + + my $cron =q(#!/usr/bin/perl # generated by logdrake use MDK::Common; my $r= "*** ". chomp_(`date`) . " ***\n"; ); +my $initdir = "/etc/init.d"; + my ($load,$mail,$email,$smtp,$sms,$smssend); $load=3; @@ -410,25 +412,30 @@ my $r= "*** ". chomp_(`date`) . " ***\n"; step_service: undef $::Wizard_no_previous; - my $l ={ - http => ["/etc/init.d/httpd", _("Apache is a World Wide Web server. It is used to serve HTML files and CGI."), '$r .= "Apache is not running\n" if (`[ -x /etc/init.d/httpd ] && LC_ALL=C /etc/init.d/httpd status` =~ /\*not\* running/);'], - bind => ["/etc/init.d/named", _("named (BIND) is a Domain Name Server (DNS) that is used to resolve host names to IP addresses."), ], - ftp => ["/etc/init.d/proftpd", _("proftpd"), '$r .= "FTP server (proftpd) is not running\n" unless (`[ -x /etc/init.d/proftpd ] && /etc/init.d/proftpd status 2>&1 > /dev/null`);'], - postfix => ["/etc/init.d/postfix", _("Postfix is a Mail Transport Agent, which is the program that moves mail from one machine to another."), '$r .= "Postfix is not running\n" unless (`[ -x /etc/init.d/postfix ] && LC_ALL=C /etc/init.d/postfix status`);'], - samba => ["/etc/init.d/smb", ("samba"), '$r .= "samba is not running\n" unless (`[ -x /etc/init.d/smb ] && LC_ALL=C /etc/init.d/smb status`);'], - sshd => ["/etc/init.d/sshd", _("sshd"), '$r .= "sshd is not running\n" unless (`[ -x /etc/init.d/sshd ] && LC_ALL=C /etc/init.d/sshd status`);'], - webmin => ["/etc/init.d/webmin", _("webmin"), '$r .= "webmin is not running\n" unless (`[ -x /etc/init.d/webmin ] && LC_ALL=C /etc/init.d/webmin status`);'], - xinetd=> ["/etc/init.d/xinetd", _("xinetd"), '$r .= "xinetd is not running\n" unless (`[ -x /etc/init.d/xinetd ] && LC_ALL=C /etc/init.d/yxinetd status`);'], - }; - + my $service ={ + httpd => _("Apache World Wide Web Server"), + bind => _("Domain Name Resolver"), + ftp => _("Ftp Server"), + postfix => _("Postfix Mail Server"), + samba => _("Samba Server"), + sshd => _("SSH Server"), + webmin => _("Webmin Service"), + xinetd => _("Xinetd Service") + }; + foreach $serv (keys %$service) { + -e "$initdir/$serv" && push (@installed_d,$serv); + } + $in->ask_from(_("service setting"), _("You will receive an alert if one of the selected service is no more running"), - [ map { {label => "$_", val=> \${$_}, type => "bool", text => "$l->{$_}[1]" }; } keys %$l + [ map { {label => "$_", val=> \${$_}, type => "bool", text => "$service->{$_}" }; } @installed_d ]) or goto begin; $cron .= "#- check services\n"; - for (keys %$l) { - $cron .= $l->{$_}[2]."\n" if (${$_}); + for (keys %$service) { +# $cron .= $l->{$_}[2]."\n" if (${$_}); + if(!-e "/var/lock/subsys/$_") { $r .="Service $_ ($service->{$_} is not running\n"}; + $cron .= "$r"; } step_load: @@ -545,6 +552,11 @@ sub destroy_window { # log # $Log$ +# Revision 1.16 2002/07/25 21:23:31 daouda +# - don't display services that are not installed +# - word wrap string correctly +# - cleanup +# # Revision 1.15 2002/03/14 18:09:12 yduret # fix some bug # -- cgit v1.2.1