ms won't return from ssh
Jim Levie
jim at ENTROPHY-FREE.NET
Fri Sep 27 01:15:27 IST 2002
On Thu, 2002-09-26 at 16:42, Eric H wrote:
> When I run a command like from mymachine:
>
> mymachine# ssh myothermachine /usr/local/sbin/restart.sendmail
>
> It will run the restart.sendmail script but it won't return back to
> the prompt, or more importantly the other script which ordinarily calls
> restart.sendmail.
>
> cat /usr/local/sbin/restart.sendmail
> # stop everything
> killall -9 sendmail
> killall -9 mailscanner
>
> # start everything
> # incoming sendmail
> /usr/sbin/sendmail -bd -ODeliveryMode=queueonly
> -OQueueDirectory=/var/spool/mqueue.in
>
> # outgoing sendmail
> /usr/sbin/sendmail -q5m
>
> # mailscanner
> #/usr/local/MailScanner/bin/check_mailscanner
> /usr/local/MailScanner/bin/mailscanner /usr/local/MailScanner/etc/mailscanner.conf
>
> However, this returns just fine, which is what I running before
> implementing mailscanner:
>
> #!/bin/bash
> kill `head -1 /var/run/sendmail.pid`
> sleep 3
> /usr/sbin/sendmail -bd -q5m
>
> Any ideas? I'm stumped. It has something to do with mailscanner, not
> check_mailscanner. Version 3.22-13, btw.
>
I believe the problem lies in the way Perl handles STDIN/STDOUT/STDERR.
Basically that it needs a controlling terminal to operate. I've played
around with it a bit and I can get a perl program to not hang an ssh
command when launched, but the process then exits instead of continuing
to run. Essentially I wrote a small program that would daemonize itself,
like MailScanner, to investigate what was happening.
The only thing that I can say is not to try to do it via an ssh command.
You can accomplish what you want by having the script just kill
MailScanner and allow check_mailscanner to fire it back from cron. To
reduce the delay invoke check_mailscanner once a minute from cron.
--
The instructions said to use Windows 98 or better, so I installed
RedHat.
More information about the MailScanner
mailing list