[Discuss] rsync issue

Derek Martin invalid at pizzashack.org
Mon Nov 14 19:11:55 EST 2022


On Fri, Nov 04, 2022 at 04:22:56PM -0400, dan moylan wrote:
> BUT -- here's another little oddity.  it works fine from the
> command line prompt, but not in a cron script (where i want to
> use it).  it works in the cron script on aldeberan.

The cron angle is an important detail that you left out of your
original message.  OpenSSH commands use the environment (specifically
SSH_AUTH_SOCK) to tell each other how to access your SSH agent.  Your
cron job normally has no access to your user environment (it would
need to be a child of the shell that started your agent, which it will
never be), so it has no idea how to find your agent.  So the odd part
here is that it works on aldeberan.

For that to work, you would need something fairly hacky so that your
cron job knows how to find your agent.  Hopefully that's enough for
you to figure it out, because there's no one obvious "normal" way to
do this--whatever you did to make it work on aldeberan would
necessarily be specific to you and your environment.

One thing I noted is that your !# line (from the script you pasted,
first message) uses /bin/bash rather than /bin/sh.  This causes a
behavior difference which is IMO a bit sinister due to likely being
unexpected:  It causes your .bashrc file to be sourced, *even from
shell scripts*, whereas /bin/sh does not.  I have a suspicion that
your .bashrc does something funky with SSH_AUTH_SOCK on the machine
where it works, that's missing from the machine where it does not.  If
that's not it, I can only wish you the best of luck finding whatever
it is... =8^)

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.



More information about the Discuss mailing list