LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Cannot execute rsync as a cron job (https://www.linuxquestions.org/questions/linux-software-2/cannot-execute-rsync-as-a-cron-job-479476/)

jdaniels73 09-01-2006 12:52 PM

Cannot execute rsync as a cron job
 
Hi all,

Using:
Redhat ES4 U3 (local) to Redhat 7.3 (remote)
rsync version 2.6.3 protocol version 28 (local) to rsync version 2.5.4 protocol version 26 (remote)
OpenSSH_3.9p1 on both servers

I am attempting to execute the following rsync command on my local server as a cron job for the user "bob":
Code:

* * * * * /usr/bin/rsync -av /path/to/sourcefiles/ root@<remoteserver>:/path/to/synchedfiles/
However it just does not work - even though I have it running every minute. What's odd is that I can execute this file, as the user "bob", exactly as it is shown above, and it works fine:

Code:

[localserver bob]$ /usr/bin/rsync -av /path/to/sourcefiles/ root@<remoteserver>:/path/to/synchedfiles/
I'vr tried removing the verbosity - no joy. I have already generated SSH keys for the involved users so there should be no required user input and I have tested this at the command line. I believe that cron has it's own environment of sorts but I figured that using absolute paths would bypass that. I also tried placing the whole command in a script and having that as the executed cron job command but no joy.

Anyone know any workarounds? There are no mesages in any logs that are of any help :)

Cheers,
Jon

tredegar 09-02-2006 09:25 AM

Maybe you could redirect the standard error to a file, then take a look at that and find out what the problem is that way?
Code:

* * * * * /usr/bin/rsync -av /path/to/sourcefiles/ root@<remoteserver>:/path/to/synchedfiles/ 2> myerrorlog

jdaniels73 09-03-2006 06:03 AM

Quote:

Originally Posted by tredegar
Maybe you could redirect the standard error to a file, then take a look at that and find out what the problem is that way?
Code:

* * * * * /usr/bin/rsync -av /path/to/sourcefiles/ root@<remoteserver>:/path/to/synchedfiles/ 2> myerrorlog

Hi,

Thanks for the tip! I did this (I actually outputted to stdout and stderr) and, bizarrely, while the output files contaned 0 bytes, the files themselves (the ones to be rsync'ed) are now getting synched properly...

Must be user error ;)

Thanks again


All times are GMT -5. The time now is 10:20 AM.