&& test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail"; my $command = ''; my $ok = ''; my $mailto = ''; my $mmode = ''; my $qmode = ''; my $msp_line = ''; my $mta_line = ''; my $age_line = ''; ($ok, $mailto) = &Parse_conf::get_value('CRON_MAILTO'); if ( ! $ok ) { return; }; my $out_file = $output_file || "/etc/cron.d/sendmail"; print STDOUT "Writing $out_file.\n"; $out_file = '&STDOUT' if ($out_file eq '-'); unless ( open($ofh, ">$out_file") ) { warn("Could not open $out_file($!), using STDOUT\n"); open($ofh, ">&STDOUT"); }; $out_file = '-' if ($out_file eq '&STDOUT'); print $ofh <<"EOT"; #################################################################### ##### This file is automagically generated -- edit at your own risk ##### ##### file: ${out_file} ##### generated via: (${interp_pgm} ${interp_vrm}) ##### ${main::program_name} ##### version: ${main::program_version} ${main::program_date} ##### by: ${user}\@${hostname} ##### on: ${current_time} ##### in: ${directory} ##### input files: EOT foreach my $file ( split(' ', $input_file) ) { print $ofh <<"EOT"; ##### ${file} EOT }; print $ofh <<"EOT"; ##### #################################################################### #------------------------------------------------------------------------------ # # $out_file # # Copyright (c) 2001-2010 Richard Nelson. All Rights Reserved. # Version: ${main::program_version} # Time-stamp: <${main::program_date}> # # Sendmail crontab - Call sendmail at various times to do the following: # 1) Age queues - move undelivered mail to a slower queue # 2) Retry any mail queued by the message submission process # 3) run the queues (deliver mail) if a standalone daemon is not desired # # Each processes is independant and guided by /etc/mail/sendmail.conf and # {sendmail,submit}.mc files. # # There isn't anything here that should need touching. # # Any requisite queue/misc parameters must be set in /etc/mail/sendmail.conf # and reflected herein via /usr/sbin/sendmailconfig (or more directly via # ${main::program_name}). # #------------------------------------------------------------------------------ # # use default path, shell, home #SHELL=/bin/sh #PATH= #HOME= # send mail to this user, as `mail/smmsp` isn't real. MAILTO=$mailto # # format of entries: # m h dom mon dow user command # #------------------------------------------------------------------------------ # Every so often, give sendmail a chance to run the MSP queues. # EOT ($ok, $interval) = &Parse_conf::get_value('MSP_INTERVAL'); ($cronint, $ok) = &sm2cron_time($interval); $command = "$test && /usr/share/sendmail/sendmail cron-msp"; ($ok, $mmode) = &Parse_conf::get_value('MSP_MODE'); ($ok, $qmode) = &Parse_conf::get_value('QUEUE_MODE'); if ($mmode eq 'Cron' and ($interval ne '') #or ($mmode eq 'None' and $qmode eq 'Cron') ) { $msp_line = "$cronint\t\tsmmsp\t$command"; } else { $msp_line = "#$cronint\t\tsmmsp\t$command"; }; print $ofh "$msp_line\n"; print $ofh <<"EOT"; # #------------------------------------------------------------------------------ # Every so often, give sendmail a chance to run the MTA queues. # Will also run MSP queues if enabled # EOT ($ok, $interval) = &Parse_conf::get_value('QUEUE_INTERVAL'); ($cronint, $ok) = &sm2cron_time($interval); $command = "$test && /usr/share/sendmail/sendmail cron-mta"; if ($qmode eq 'Cron' and ($interval ne '') ) { $mta_line = "$cronint\t\troot\t$command"; } else { $mta_line = "#$cronint\t\troot\t$command"; }; print $ofh "$mta_line\n"; print $ofh <<"EOT"; # #------------------------------------------------------------------------------ # Every so often, give sendmail a chance to age the queues. # EOT ($ok, $var) = &Parse_conf::get_value('AGE_DATA'); my $tmpval = eval $var; if ($@) { warn $@; } else { $var = $tmpval; }; if (not ref $var) { print $ofh "# No queue aging\n"; } elsif (@{$var} == 0) { print $ofh "# No queue aging\n"; } else { foreach my $entry (@{$var}) { ($interval, $ok) = &sm2cron_time(@$entry[0]); my $criteria = @$entry[1] || join('','-s ',$ok); my $to = @$entry[2]; my $from = @$entry[3]; $command = "$test && /usr/share/sendmail/qtool.pl"; $from = "/var/spool/mqueue/$from" if ($from !~ /^\//); $to = "/var/spool/mqueue/$to" if ($to !~ /^\//); $age_line = "$interval\t\troot\t$command $criteria $to $from"; print $ofh "$age_line >/dev/null\n"; }; }; print $ofh <<"EOT"; # EOT close($ofh); }; #