From 992308b51918c7929c235a89ffaaecb85649df66 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 2 Feb 2004 17:41:20 +0000 Subject: add "remove cron entry" on arnaud request --- perl-install/standalone/logdrake | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'perl-install') diff --git a/perl-install/standalone/logdrake b/perl-install/standalone/logdrake index ea7303a9d..455598e04 100755 --- a/perl-install/standalone/logdrake +++ b/perl-install/standalone/logdrake @@ -365,6 +365,12 @@ sub alert_config() { use wizards; my $w = wizards->new; + my $mode; + my $cron_file = "/etc/cron.hourly/logdrake_service"; + my %modes = ( + configure => N("Configure the mail alert system"), + disable => N("Stop the mail alert system"), + ); my $wiz = { defaultimage => "wiz_logdrake.png", name => N("Mail alert"), @@ -373,7 +379,12 @@ sub alert_config() { name => N("Mail alert configuration") . "\n\n" . N("Welcome to the mail configuration utility.\n\nHere, you'll be able to set up the alert system.\n"), no_back => 1, - next => 'services' + data => [ + { val => \$mode, label => N("What do you wan to do?"), + list => [ keys %modes ], format => sub { $modes{$_[0]} }, }, + ], + + post => sub { $mode eq 'configure' ? 'services' : 'stop' }, }, services => { name => N("Services settings") . "\n\n" . @@ -412,14 +423,22 @@ sub alert_config() { no_back => 1, next => 0 }, + stop => { + pre => sub { rm_rf($cron_file) }, + name => N("Congratulations") . "\n\n" . N("The wizard successfully disabled the mail alert."), + end => 1, + no_back => 1, + next => 0 + }, }, }; $w->process($wiz, $in); + return if $mode eq 'disable'; $options{SERVICES} = join ':', grep { $services_to_check{$_} } sort keys %services_to_check; use Data::Dumper; - output_with_perm "/etc/cron.hourly/logdrake_service", 0755, q(#!/usr/bin/perl + output_with_perm $cron_file, 0755, q(#!/usr/bin/perl # generated by logdrake use MDK::Common; my $r; -- cgit v1.2.1