On Sun, 24 May 2009 11:10:04 +0200
Jarry <[email protected]> wrote:

> # /etc/init.d/MailScanner stop
> * Stopping MailScanner...
> * MailScanner: caught SIGTERM, aborting


Looks like there's a line in "stop" section that kills the script
itself. Try looking for a lines like these:

  pkill MailScanner
  killall MailScanner
  start-stop-daemon --stop --name MailScanner

Sure, they might be killing the app as well (if the process has
MailScanner in it's name), but there should be full path or pid-based
line instead, so the initscript will exit cleanly.


> # /etc/init.d/MailScanner start
> * WARNING: MailScanner has already been started


Following command should "wipe" initscript memory:

  /etc/init.d/MailScanner zap

...so it'll think MailScanner wasn't even started, but that should be
used as a workaround rather than a solution since it leaves init-system
in different state than it thinks it is.
Direct effect is that it won't execute "stop" action on shutdown since
it won't know the script even started.


> Actually, MailScanner stops, but sendmail which has been
> started by MailScanner init script is still there running:
> 
> # ps -e | grep sendmail
> 18676 ?        00:00:00 sendmail
> 18679 ?        00:00:00 sendmail


Could be because of aforementioned script "self-destruction".
If sendmail really started by the same script, not as a dependency,
that is.


> Even whenn I killall sendmail, I still get the above mentioned
> warning, and can not start MailScanner. And that is a problem,
> because MailScanner is restarted every hour (to prevent eating
> all resources). I checked /var/run and /var/lock, there is
> no trace of MailScanner or sendmail running, yet I can not
> re-start Mailscanner. How can I fix this problem?


Try using "start-stop-daemon -m/-p/--exec" to start and stop binaries,
instead of relying on process names (which can be easily changed, btw)
and try to use app-created pidfiles, if the launched app has this
capability, since it should know better which of it's processes should
receive stop signal.


-- 
Mike Kazantsev // fraggod.net

Attachment: signature.asc
Description: PGP signature

Reply via email to