Fred Stluka on 9 Apr 2012 13:07:00 -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 2:50 PM, Russ Thompson wrote:
Before calling your script, perhaps source /etc/profile so the appropriate environment paths are set. The sourcing should be done during connection, prior to running your script.

I've ran into issues like this before with ptty and it was usually environment related, but in your case, doesn't make a ton of sense since it works with different conditions (sleep etc).
My default shell is tcsh, not sh or bash, so /etc/profile should not
matter, but I'm pretty sure the environment is not the problem in
this case.  In any case, I tried the tcsh equivalent.  Same problem.

ssh -t mydomain.com "source /etc/csh.cshrc; source /etc/csh.login; ./junk"


Is the script executing cleanly by viewing the return variable $?
If I add echo $status, I see that the piped mail command is returning
0 (success).

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

If I echo $status after running the script, I see that the script is
returning 0 (success).

    ssh -t cloud1.balancedcomputing.com "./junk; echo $status"

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