Tips & tricks


Here it comes: a few tips how to make linux work better. Mostly useful things (now only one). I'll add another thigs in the future.


HOWTO make sendmail queue mail automatically, until the internet connection is up

In /etc/ directory is a file, named sendmail.cf (if you use sendmail). Set up the three parameters (keywords) described below and start sendmail :

/etc/sendmail.cf

# default delivery mode
Odqueue                   <--insert this
#Odbackground             <-- # this line




# fallback MX host
#OVfall.back.host.net      <-- # this line
OVlocalhost                <--insert this



# if we are the best MX host for a site, try it directly instead of config err
#OwFalse                   <-- # this line
OwTrue                     <--insert this

# Insist that the BIND name server be running to resolve names
#OI                        <-- # this line
Well, it's done! The only thing required (only for now, the next startup will be OK) is to kill the running sendmail and start it this way (as a root):

root# sendmail -bd -q5m

Ok, it's running. After then, change the sendmail startup parameters in /etc/rc.d/rc.M script to start sendmail automatically at boot:

# Update all the shared library links automatically
  /sbin/ldconfig

  # Start the sendmail daemon:
  if [ -x /usr/sbin/sendmail ]; then
   echo "Starting sendmail daemon (/usr/sbin/sendmail -bd -q5m)..."
   /usr/sbin/sendmail -bd -q5m
  fi

  # Load a custom screen font if the user has an rc.font script.
  if [ -r /etc/rc.d/rc.font ]; then
    /etc/rc.d/rc.font
  fi
The -q5m statement is time in minutes, after which sendmail tries to resend mail queued (btw, they're in /var/spool/mqueue/ directory if you were searching them....for example if you sent offline a mail with some nasty things to president such as "abortions are good", which is illegal in US (:-), it's possible to ask root to change it to "I like my teddy bear" which isn't yet (IMHO)).

If you connect to internet and want to sendmail send the mail queued right now, issue the following command:
anybody:$ sendmail -q
by which you instruct sendmail to process the mail queue and try to send the messages. If you wanted to know, what's in the mail queue, run this:

smrt:~$ sendmail -bp
                Mail Queue (1 request)
--Q-ID-- --Size-- -----Q-Time----- ------------Sender/Recipient------------
DAA06192      271 Sat Mar 16 03:27 
                 (cslab.felk.cvut.cz: Name server timeout)
                                   

Well, that's what I found out, thanks to you in c.o.l.n for your suggests! You may experiment anyway, if something goes wrong (sendmail is a bitch).


Back to my homepage