[CentOS] difference between cron and shell invocation.

Tue Dec 7 14:39:21 UTC 2010
m.roth at 5-cent.us <m.roth at 5-cent.us>

James B. Byrne wrote:
>
> I have a fairly involved root cron task that I moved verbatim from
> another server. On the original server, this task ran without
> problem.  On the new server, when this task runs via cron, which I
> confirm is happening by looking in the cron log, no files are
> transferred and no error is reported.  However, if I copy cron
> command from roots crontab and paste it into a terminal session on
> the new server then the task runs to completion and the files are
> transferred.
>
> This task involves sshfs, fuse, and rsync and employs pki
> certificates for authentication.  The fact that it works from the
> shell without alteration and yet not from cron is the issue.
>
> Does anyone have any idea where I would start to track down what is
> going on?

Sure - it's pretty obvious that something in the environment is missing.
Try putting env in the cron job, or run the actual job as a shell script,
and in the script, put env and pipe that to a file, so that you can then
compare that with your env o/p as root.

          mark