Fred Stluka on 9 Apr 2012 12:42:44 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Why does -t option of ssh cause mail to not be sent?...

On 4/9/12 1:58 PM, Pat Barron wrote:
I wonder if, because you're attached to a terminal, the mail process is catching a SIGHUP or something and dying when the script ends? Maybe try invoking the mailer with "nohup"?


That's what I was thinking.  The script process is ending and signalling
the child processes.  But why does the script process end before the
piped mail command completes?  Does mail do an internal fork/exec
or something?

Anyhow, I tried and yes, invoking mail via nohup causes it to send the
mail properly:

    #!/bin/csh -f
    echo "hello" | nohup mail -s "Test" fred

This is an improvement over my previous solution of "sleep 1".

Fred Stluka -- --
Bristle Software, Inc -- -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

Philadelphia Linux Users Group         --
Announcements -
General Discussion  --