LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 09-01-2006, 11:52 AM   #1
jdaniels73
LQ Newbie
 
Registered: Jul 2006
Posts: 16

Rep: Reputation: 0
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
 
Old 09-02-2006, 08:25 AM   #2
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
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
 
Old 09-03-2006, 05:03 AM   #3
jdaniels73
LQ Newbie
 
Registered: Jul 2006
Posts: 16

Original Poster
Rep: Reputation: 0
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

Last edited by jdaniels73; 09-03-2006 at 05:15 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
Cron job rust8y Linux - Newbie 3 05-18-2006 09:06 AM
need help with cron job parthcorp1 Linux - General 2 02-01-2005 11:37 AM
cron job ? johnyy Linux - Software 3 12-10-2003 06:00 PM
Cron job T-Rex Linux - Newbie 1 09-26-2001 11:28 AM


All times are GMT -5. The time now is 12:18 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration