Re: sendmail and FC9/FC10

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2009-04-03 at 14:59 -0500, Gregory P. Ennis wrote: 
> I have had some intermittent problems with sendmail transfer mail to our
> gateway on some FC9 and FC10 installations.  I have had to create a cron
> job in order to force the transfer of files in /var/spool/mqueue
> 
> 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/lib/sendmail -q
> 
> I have TLS active on all systems.  
> 
> At some point in time after several updates the problem has now
> disappeared on all FC10 machines, but I have one FC9 machine that
> continues to need the cron job
> 
> Has anyone else had this problem?  Any ideas?s
>  
> Greg Ennis
> 
> 
> 
> -- 
> Greg

Everyone,

After reviewing some of the posts on this lists it appears to me that
sendmail is having trouble finding the network at start time, and unless
restarted or forced to read the queue it does not transfer any mail.

I have written a little perl script to restart sendmail after it
recognizes the network as being up.  This has solved the problem.

I do have NetworkManager running, and could not figure out a way to do
this other than to restart sendmail.  If you start this script in
/etc/rc.d/rc.local and create the appropriate sub directory as
the /var/log/smile it should at least bypass the problem with
NetworkManager.

Greg

#!/usr/bin/perl -w
# s.sendmail.check.prl.001
#
# This script will check to see if a network connection exits
# and is functioning
#
# If a network is not functioning it will wait for this to happen
# and restart sendmail so that it will process the queues
#
# by : Gregory P. Ennis Grapevine Texas  April 3, 2009
#

use POSIX qw(setsid);

#----------------------------------------------------------------------
#Command Module

# This should fork the process to a daemon if you use the command line

defined( my $pid = fork ) or die "Can't fork: $!";
exit if $pid;
setsid or die "Can't start a new session: $!";

# This should redirect standard out and standard error to log files
open STDOUT, ">>/var/log/smile/s.sendmail.check.log"
  or die "Can't write to s.sendmail.check.lp: $!";
open STDERR, ">>/var/log/smile/s.sendmail.check.error.log"
  or die "Can't write to s.sendmail.check.error.log: $!";



$DATE = `date`;
chomp $DATE;
print "Starting daemon for network checking for sendmail : $DATE\n";
sleep 300;

&Fill_Strings;
&Check_Network;
&Restart_Sendmail;

exit $ERROR;

#---------------------------------------------------------------------

#---------------------------------------------------------------------

sub Fill_Strings {
    $NET_FLAG = 0;
    $NET_PRESENCE = "";
    $count = 0;
    $ERROR = 0;
}

sub Check_Network {

    while ( $NET_PRESENCE eq "" ) {
     if ( $count == 100 ) {
        print "Unable to restart sendmail network was never active\n";
        $ERROR = 5;
        return;
        }
     if ( $count > 0 )  {
        sleep 10;
        }
     $count++;
     $d_tmp=`date`;
     chomp $d_tmp;
     print "Looking For Network # $count $d_tmp\n";
     $NET_PRESENCE=`/sbin/ifconfig eth0 | /bin/grep 'inet '
& /sbin/ifconfig eth1 | /bin/grep 'inet '`;
      }
   print "Network Setup : ";
   chomp $NET_PRESENCE;
   $NET_PRESENCE =~ s/^\s+//;
   print "$NET_PRESENCE\n";
   $NET_FLAG++;
}

sub Restart_Sendmail {

  if ( $NET_FLAG > 0 ) {
     $arg = `service sendmail restart`;
     print "$arg\n";
    }
  else {
    print "Network connection could not be established\n";
   }

}

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux