diff options
-rwxr-xr-x | bin/send-reports | 23 | ||||
-rw-r--r-- | conf/crontab.ugly | 5 |
2 files changed, 18 insertions, 10 deletions
diff --git a/bin/send-reports b/bin/send-reports index 626eb63cf..7c6d0f7a0 100755 --- a/bin/send-reports +++ b/bin/send-reports @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: send-reports,v 1.32 2007-04-19 12:08:53 matthew Exp $ +# $Id: send-reports,v 1.33 2007-04-19 14:35:41 matthew Exp $ use strict; require 5.8.0; @@ -36,9 +36,12 @@ BEGIN { use mySociety::Dress; -die "No arguments or specify --nomail" if (@ARGV>1); +die "Either no arguments, --nomail or --verbose" if (@ARGV>1); my $nomail = 0; +my $verbose = 0; $nomail = 1 if (@ARGV==1 && $ARGV[0] eq '--nomail'); +$verbose = 1 if (@ARGV==1 && $ARGV[0] eq '--verbose'); +$verbose = 1 if $nomail; my (%notgot, %note); my $unsent = dbh()->selectall_arrayref( @@ -71,8 +74,10 @@ foreach my $row (@$unsent) { } my @recips = keys %recips; if (!@to) { - print 'Need to send problem #' . $row->{id} . ' to council(s) ' . join(',',@recips) . "\n"; - print " ...but we have no contact details for any of them!\n"; + if ($verbose) { + print 'Need to send problem #' . $row->{id} . ' to council(s) ' . join(',',@recips) . "\n"; + print " ...but we have no contact details for any of them!\n"; + } next; } next unless ($all_confirmed); @@ -128,9 +133,11 @@ If you know of an appropriate contact address, please do get in touch. ]\n\n"; } } -print "Council email addresses that need checking:\n" if keys %notgot; -foreach my $e (keys %notgot) { - foreach my $c (keys %{$notgot{$e}}) { - print $notgot{$e}{$c} . " problem, to $e category $c (" . $note{$e}{$c}. ")\n"; +if ($verbose) { + print "Council email addresses that need checking:\n" if keys %notgot; + foreach my $e (keys %notgot) { + foreach my $c (keys %{$notgot{$e}}) { + print $notgot{$e}{$c} . " problem, to $e category $c (" . $note{$e}{$c}. ")\n"; + } } } diff --git a/conf/crontab.ugly b/conf/crontab.ugly index b70cd5e36..aae1a57a8 100644 --- a/conf/crontab.ugly +++ b/conf/crontab.ugly @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org/ # -# $Id: crontab.ugly,v 1.4 2007-03-08 11:37:42 matthew Exp $ +# $Id: crontab.ugly,v 1.5 2007-04-19 14:35:44 matthew Exp $ PATH=/usr/local/bin:/usr/bin:/bin !!(* if ($vhost eq "matthew.bci.mysociety.org") { *)!! @@ -13,6 +13,7 @@ MAILTO=matthew@mysociety.org MAILTO=team@neighbourhoodfixit.com !!(* } *)!! -30 6-23 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-reports.lock /data/vhost/!!(*= $vhost *)!!/mysociety/bci/bin/send-reports || echo "stalled?" +*/5 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-reports.lock /data/vhost/!!(*= $vhost *)!!/mysociety/bci/bin/send-reports || echo "stalled?" +3 5 * * * !!(*= $user *)!! run-with-lockfile -n "/data/vhost/!!(*= $vhost *)!!/send-reports.lock /data/vhost/!!(*= $vhost *)!!/mysociety/bci/bin/send-reports --verbose" || echo "stalled?" 2 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-alerts.lock /data/vhost/!!(*= $vhost *)!!/mysociety/bci/bin/send-alerts || echo "stalled?" |