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"?

Pat,

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
------------------------------------------------------------------------
Fred Stluka -- mailto:fred@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
------------------------------------------------------------------------

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug