summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xperl-install/standalone/logdrake39
1 files changed, 19 insertions, 20 deletions
diff --git a/perl-install/standalone/logdrake b/perl-install/standalone/logdrake
index 36f2ebf51..5d5b9e73e 100755
--- a/perl-install/standalone/logdrake
+++ b/perl-install/standalone/logdrake
@@ -189,13 +189,16 @@ gtkadd($my_win->{window},
)) : (1, create_scrolled_window($log_text)),
if_(!$::isExplain, 0, gtkadd(gtkset_border_width(gtkset_layout(Gtk2::HButtonBox->new, 'end'), 5),
if_(!$::isFile, gtksignal_connect(new Gtk2::Button(N("Mail alert")),
- clicked => sub { eval { alert_config() };
- if ($@ =~ /wizcancel/) {
- $::Wizard_no_previous = 1;
- $::Wizard_no_cancel = 1;
- $::WizardWindow->destroy if defined $::WizardWindow;
- undef $::WizardWindow;
- } })),
+ clicked => sub {
+ eval { alert_config() };
+ if ($@ =~ /wizcancel/) {
+ $::Wizard_no_previous = 1;
+ $::Wizard_no_cancel = 1;
+ $::WizardWindow->destroy if defined $::WizardWindow;
+ undef $::WizardWindow;
+ }
+
+ })),
gtksignal_connect(new Gtk2::Button(N("Save")), clicked => \&save),
gtksignal_connect(new Gtk2::Button($::isEmbedded ? N("Cancel") : N("Quit")), clicked => \&quit)
)
@@ -378,7 +381,7 @@ sub alert_config {
my $cron = q(#!/usr/bin/perl
# generated by logdrake
use MDK::Common;
-my $r = "*** ". chomp_(`date`) . " ***\n";
+my $r = "*** " . chomp_(`date`) . " ***\n";
);
@@ -411,17 +414,16 @@ my $initdir = "/etc/init.d";
foreach my $serv (keys %$service) {
-e "$initdir/$serv" && push @installed_d, $serv;
}
-
+ my %services_to_check;
$in->ask_from(N("service setting"),
N("You will receive an alert if one of the selected services is no longer running"),
- [ map { { label => $_, val => \${ $_ }, type => "bool", text => $service->{$_} } } @installed_d
+ [ map { { label => $_, val => \$services_to_check{$_}, type => "bool", text => $service->{$_} } } @installed_d
]) or goto begin;
$cron .= "#- check services\n";
- my $r;
- foreach (@installed_d) {
- $r .= "Service $_ ($service->{$_} is not running\n" unless -e "/var/lock/subsys/$_";
-# $cron .= "$r" if ${ $_ }; # take a look at this, don't know what is done here
+ foreach (keys %services_to_check) {
+ next unless $services_to_check{$_};
+ $cron .= "\$r .= \"Service $_ ($service->{$_} is not running)\\n\" unless -e \"/var/lock/subsys/$_\";\n";
}
step_load:
@@ -451,14 +453,11 @@ EOF
$cron .= q(#- report it
-$email = ) . "'$email';\n\n";
+my $email = ) . "'$email';\n\n";
- $cron .= q(
-local *F;
+ $cron .= q(local *F;
open F, '|/usr/sbin/sendmail -oi -t';
-
-print F
-q(Subject: logdrake Mail Alert
+print F q(Subject: logdrake Mail Alert
From: root@localhost
To: ), "$email\n";
print F $r;