RC scripts - restart not working
Spicer, Kevin
Kevin.Spicer at BMRB.CO.UK
Fri Aug 29 09:05:51 IST 2003
David Hooton wrote:
> Hi Kevin,
>
> Our systems software (not controlled by us) restarts sendmail every 15
> mins - this causes MailScanner to try to run in parrallel with
> Sendmail.
>
> We've managed to circumvent this by adding a script at the end of the
> cron job that "Restarts" MailScanner and kills any rouge Sendmail
> processes.
>
> I'm sure there must be a better way, any and all suggestions
> appreciated. Unfortunately the systems software is all encrypted code
> and can't be altered :(
>
Okay, so its the sendmail processes that are the issue. You don't need to touch MailScanner at all. You can leave MailScanner running and just mess with the sendmail processes.
Killing all sendmail processes at the end of the program might be an option, best to do this in a loop, eg. [UNTESTED CODE!!]
#!/bin/sh
# Whilst we can find sendmail processes loop attempting to kill them
while ps -elf | grep -q [s]endmail
do pkill sendmail
sleep 1
done
/etc/init.d/MailScanner startin
/etc/init.d/MailScanner startout
## SCRIPT ENDS
But I don't think this is the best answer, as you'll constantly be stopping and restarting sendmail, and theres always a risk that it could pass a virus through in the seconds it may be up.
If your process that restarts sendmail does so by calling the init script for sendmail you could just add 'exit' as the second line of the init script.
BMRB International
http://www.bmrb.co.uk
+44 (0)20 8566 5000
_________________________________________________________________
This message (and any attachment) is intended only for the
recipient and may contain confidential and/or privileged
material. If you have received this in error, please contact the
sender and delete this message immediately. Disclosure, copying
or other action taken in respect of this email or in
reliance on it is prohibited. BMRB International Limited
accepts no liability in relation to any personal emails, or
content of any email which does not directly relate to our
business.
More information about the MailScanner
mailing list