faqts : Computers : Internet : Mail Servers : qmail : Tips and Tricks : Controlling Daemons

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

3 of 3 people (100%) answered Yes
Recently 3 of 3 people (100%) answered Yes

Entry

How do I get qmail-send and qmail-smtpd to run under daemontools?

Aug 26th, 2001 18:46
Brian Coogan,


Dan has a nice FAQ answer on this:
  http://cr.yp.to/qmail/faq/admin.html#supervise
Basically, set up daemontools on the machine and install the svscan 
line in /etc/rc.local or appropriate similar file:
  http://cr.yp.to/daemontools/faq.html
At this stage you should shutdown any existing qmail daemons (see FAQTS 
answer for how).  Then, create the directory /service/qmail and 
link /var/qmail/rc to it:
  mkdir /service/qmail
  ln -s /var/qmail/rc /service/qmail/run
This controls outgoing email.  The rationale behind this is that the 
qmail rc file starts up (execs) the qmail-send process which acts as 
parent for all the other outgoing qmail processes.  Qmail-send is the 
process to kill to shutdown qmail.
You can create a service for qmail-smtpd similarly by taking the 
tcpserver line that you're using and putting it in a run file, with 
appropriate '#! /bin/sh' as the first line, ensuring it is mode 755 
executable, and using an exec.
You should use 'exec' in both files to avoid creating another long 
running shell process for each daemon.
You can now use commands like:
  svc -d /service/qmail*    to shut qmail down
  svc -a /service/qmail     to force a queue rerun early
  svc -u /service/qmail     to start qmail up again
  svc -t /service/qmail*     to restart qmail processes
Life with Qmail discusses similar techniques for this.