MailScanner in foreground - use MailScanner with DJB's daemontools

Mariano Absatz mailscanner at LISTS.COM.AR
Sun May 30 21:14:55 IST 2004


I forgot a couple of things... you actually should read daemontools docs, but 
anyway.

If you leave the symlink in /service to /opt/MailScanner, MailScanner will 
start while booting.

If you want to temporarily stop MailScanner:
# svc -d /service/MailScanner
will do it (it will start up again at next boot)

To start it after you stopped it like above:
# svc -u /service/MailScanner

To restart it while running:
# svc -t /service/MailScanner

To just reload it while running:
# svc -h /service/MailScanner

To see if it's running and for how long:
# svstat /service/MailScanner

To stop it completely and exit its supervisor and not starting it again at 
next boot:
# svc -dx /service/MailScanner ; rm -f /service/MailScanner
(this 'rm -f' only removes the symlink, it doesn't remove anything within 
MailScanner).

Regards.

El 30 May 2004 a las 16:32, Mariano Absatz escribió:

> Hi,
> 
> I developed a patch for MailScanner to add an option (in MailScanner.conf)
> that allows it to run in foreground; that is, to not 'daemonize' itself.
> 
> This is useful when you have a tool to monitor a running process.
> 
> DJB's daemontools ( http://cr.yp.to/daemontools.html ) include such a tool,
> and it's named supervise ( http://cr.yp.to/daemontools/supervise.html ).
> 
> I also know of HA clustering tools that require programs to run in foreground
> in order to provide High Availability to it.
> 
> In http://baby.com.ar/MailScanner/RunInForeground I left a couple of patches
> for versions 4.29.7-1 and 4.30.3-2 of MailScanner.
> 
> There are also a couple of subdirectories with the completely patched files.
> 
> The modified files are:
> bin/MailScanner
> lib/MailScanner/ConfigDefs.pl
> etc/MailScanner.conf
> 
> The new option (added to the 'Advanced Settings' section of MailScanner.conf)
> is:
> Run In Foreground
> 
> The default is obviously 'no'
> 
> If you set this to 'yes', MailScanner will run in foreground, but not in
> debug mode (if you also set 'Debug = yes' then this latter setting takes
> precedence).
> 
> That is, the MailScanner main process will be a child of the launching
> process (e.g. your shell session), and it will spawn up to 'MaxChildren'
> children to do the actual job.
> 
> As a value added, MailScanner in this mode does some minimal logging to
> STDOUT which you can see in your terminal or capture somehow.
> 
> I also added a couple of 'run' scripts to use with daemontools.
> 
> One is for actually running MailScanner and is in the MailScanner directory
> itself (it requires that you run MailScanner in foreground).
> 
> The other one, in the 'log' subdirectory, is for logging the standard output
> and standard error using multilog.
> 
> After patching MailScanner and installing daemontools, you can edit
> MailScanner.conf and set 'Run In Foreground = yes'. You must stop MailScanner
> and disable the standard /etc/rc.d/init.d/MailScanner startup script (which
> would hang if MailScanner is run in foreground) with something like:
> # chkconfig MailScanner off
> Make sure both 'run' scripts are executable:
> # chmod +x /opt/MailScanner/run /opt/MailScanner/log/run
> 
> and then:
> # ln -s /opt/MailScanner /service
> 
> In a few seconds, MailScanner should be up and running.
> 
> You can monitor the new logging with:
> # tail -f /opt/MailScanner/log/main/current | tai64nlocal
> 
> Please refer to http://cr.yp.to/daemontools.html for instructions on how to
> properly use these tools.
> 
> I'll try to add an entry for this in the FAQ-O-Matic.
> 

--
Mariano Absatz
El Baby
----------------------------------------------------------
I've never met a human being who would want to read 17,000 pages
of documentation, and if there was, I'd kill him to get him out
of the gene pool.
                   -- Joseph Costello, President of Cadence

-------------------------- MailScanner list ----------------------
To leave, send    leave mailscanner    to jiscmail at jiscmail.ac.uk
Before posting, please see the Most Asked Questions at
http://www.mailscanner.biz/maq/     and the archives at
http://www.jiscmail.ac.uk/lists/mailscanner.html




More information about the MailScanner mailing list