chiark / gitweb /
--mail-final-test
[chiark-utils.git] / scripts / named-conf
index 1520fd8a7da7276339da345e3050e4f36ce2fc2f..39bee7f9ae35c2e949077549ae752c91845b5221 100755 (executable)
@@ -39,7 +39,10 @@ while (@ARGV && $ARGV[0] =~ m/^\-/) {
        last if m/^$/;
        if (m/^(yes|no|force)$/) { m/^./; $mode= $&; $domail=''; }
        elsif (m/^nothing$/) { $mode= 'x'; $domail=''; }
-       elsif (m/^mail\-(first|middle|final)/) { $mode='n'; $domail=$1; }
+       elsif (m/^mail\-(first|middle|final|final-test)/) {
+           $mode='n';
+           $domail=$1;
+       }
        elsif (m/^all$/) { $doall=1; }
        elsif (m/^config$/) { $etcfile= loarg(); $where= '--config option'; }
        elsif (m/^glueless$/) { $needglue=0; }
@@ -760,7 +763,7 @@ sub mail_zone_after () {
     close $progress_fh or die "$quis: close ${m_base}_history: $!\n";
     $progress_fh= $warn_fh= 'STDERR';
 
-    if ($domail eq 'final') {
+    if ($domail =~ m/^final/) {
        if (100*@m_fail <= $$cfg{'mailmwarn'}*(@m_fail + @m_ok)) {
            printf " %-40s ok\n" or die "$quis: mail ok report: $!\n";
        } elsif (zone_style('@',0)) {
@@ -772,7 +775,7 @@ sub mail_zone_after () {
     }      
 
     @m_fail= @m_ok= ('','')
-       if $domail eq 'final';
+       if $domail =~ m/^final/;
 
     printf $m_info "%s %s %s %s \n",
         $m_time, $m_lastok, join(':',@m_ok), join(':',@m_fail)
@@ -815,8 +818,8 @@ Subject: $zone - configuration problems report
 END
 ;
     pmail("To: ");
-    pmail("SOA MNAME for $zone <$zone_to>\nCC: ")
-       if length($zone_to);
+    pmail("(testing!) ") if $domail ne 'final';
+    pmail("SOA MNAME for $zone <$zone_to>\nCC: ") if length($zone_to);
     pmail($$cfg{'admin'}."\n\n");
     pmail <<END
 You are receiving this mail because your email address is listed
@@ -868,8 +871,8 @@ END
     defined($c= fork) or die "$quis: fork for mail: $!\n";
     if (!$c) {
        open STDIN, "<& ${m_m}" or die "$quis - sendmail: dup for stdin: $!\n";
-       exec '/usr/sbin/sendmail','-odq','-oee','-oi',
-           'ijackson@chiark.greenend.org.uk'; # should be -t
+       exec (qw(/usr/sbin/sendmail -odq -oee -oi),
+             ($domail eq 'final' ? '-t' : $$cfg{'admin'}));
        die "$quis - sendmail: exec: $!\n";
     }
     $m_m->close;