Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Rsync in cron job fails to function

13 views
Skip to first unread message

Charles Hatvany

unread,
Mar 8, 2011, 3:52:16 PM3/8/11
to
Hi,

I am not sure if there is a better place to ask this question. I have a
shell script (single line):

rsync -avz -e "ssh -i /root/cron/web-rsync-key" /usr/home/
ro...@10.0.0.232:/usr/home > /etc/rsync/output

which works fine if I run it from a prompt as:

./etc/rsync/sync

and produces output as expected to file /etc/rsync/output.

crontab contains (single line):

0,10,20,30,40,50 * * * * root /etc/rsync/sync

Cron log shows:

Mar 7 15:40:02 web /usr/sbin/cron[66012]: (root) CMD (/etc/rsync/sync)

BUT, output contains nothing (assuming I reset it to that before cron
executes the job.

Any ideas or a better place to ask this or a way to debug it?

Thanks,

Charles Hatvany
Hatvany.Net

_______________________________________________
freeb...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-isp
To unsubscribe, send any mail to "freebsd-isp...@freebsd.org"

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-...@muc.de

Vincent Hoffman

unread,
Mar 8, 2011, 4:39:43 PM3/8/11
to
Try using the full path to rsync.

Vince

Julian H. Stacey

unread,
Mar 8, 2011, 4:42:57 PM3/8/11
to
Hi,
Reference:
> From: Charles Hatvany <cha...@hatvany.com>
> Date: Tue, 08 Mar 2011 15:52:16 -0500
> Message-id: <4D769700...@hatvany.com>

Charles Hatvany wrote:
> Hi,
>
> I am not sure if there is a better place to ask this question. I have a
> shell script (single line):
>
> rsync -avz -e "ssh -i /root/cron/web-rsync-key" /usr/home/
> ro...@10.0.0.232:/usr/home > /etc/rsync/output
>
> which works fine if I run it from a prompt as:
>

> /etc/rsync/sync
>
> and produces output as expected to file /etc/rsync/output.
>
> crontab contains (single line):
>
> 0,10,20,30,40,50 * * * * root /etc/rsync/sync
>
> Cron log shows:
>
> Mar 7 15:40:02 web /usr/sbin/cron[66012]: (root) CMD (/etc/rsync/sync)
>
> BUT, output contains nothing (assuming I reset it to that before cron
> executes the job.
>
> Any ideas or a better place to ask this or a way to debug it?

Cron I recall does not have /usr/local/bin in path ?.
Try either
/usr/local/bin/rsync
or add local to PATH

Cheers,
Julian
--
Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com
Mail plain text; Not quoted-printable, Not HTML, Not base 64.
Reply below text sections not at top, to avoid breaking cumulative context.

Charles Hatvany

unread,
Mar 7, 2011, 8:47:14 PM3/7/11
to
Hi,

I am not sure if there is a better place to ask this question. I have a
shell script (single line):

rsync -avz -e "ssh -i /root/cron/web-rsync-key" /usr/home/
ro...@10.0.0.232:/usr/home > /etc/rsync/output

which works fine if I run it from a prompt as:

./etc/rsync/sync

and produces output as expected to file /etc/rsync/output.

crontab contains (single line):

0,10,20,30,40,50 * * * * root /etc/rsync/sync

Cron log shows:

Mar 7 15:40:02 web /usr/sbin/cron[66012]: (root) CMD (/etc/rsync/sync)

BUT, output contains nothing (assuming I reset it to that before cron
executes the job.

Any ideas or a better place to ask this or a way to debug it?

Thanks,

Charles Hatvany
Hatvany.Net

Shabotinsky Edward

unread,
Mar 8, 2011, 6:14:38 PM3/8/11
to
I would look at the logs at remote host

Sent from my iPhone

Xin LI

unread,
Mar 8, 2011, 6:41:51 PM3/8/11
to
On Mon, Mar 7, 2011 at 5:47 PM, Charles Hatvany <cha...@hatvany.com> wrote:
> Hi,
>
> I am not sure if there is a better place to ask this question.  I have a
> shell script (single line):
>
> rsync -avz -e "ssh -i /root/cron/web-rsync-key" /usr/home/
> ro...@10.0.0.232:/usr/home > /etc/rsync/output
>
> which works fine if I run it from a prompt as:
>
> ./etc/rsync/sync
>
> and produces output as expected to file /etc/rsync/output.
>
> crontab contains (single line):
>
> 0,10,20,30,40,50        *       *       *       *       root /etc/rsync/sync
>
> Cron log shows:
>
> Mar  7 15:40:02 web /usr/sbin/cron[66012]: (root) CMD (/etc/rsync/sync)
>
> BUT, output contains nothing (assuming I reset it to that before cron
> executes the job.
>
> Any ideas or a better place to ask this or a way to debug it?

Common problem would be rsync is not in $PATH and you didn't specified
full path. Try either adding it into PATH on the crontab, or using
full path and see if that helps?

Cheers,
--
Xin LI <del...@delphij.net> http://www.delphij.net

Charles Hatvany

unread,
Mar 9, 2011, 10:20:22 AM3/9/11
to
Thank you to all who have responded. The path to rsync was actually in
$PATH, but that was undefined within cron. The full path did the trick.
Thanks!!!

Charles

On 3/8/2011 6:41 PM, Xin LI wrote:
> On Mon, Mar 7, 2011 at 5:47 PM, Charles Hatvany<cha...@hatvany.com> wrote:

>> Hi,
>>
>> I am not sure if there is a better place to ask this question. I have a
>> shell script (single line):
>>
>> rsync -avz -e "ssh -i /root/cron/web-rsync-key" /usr/home/
>> ro...@10.0.0.232:/usr/home> /etc/rsync/output
>>
>> which works fine if I run it from a prompt as:
>>
>> ./etc/rsync/sync
>>
>> and produces output as expected to file /etc/rsync/output.
>>
>> crontab contains (single line):
>>
>> 0,10,20,30,40,50 * * * * root /etc/rsync/sync
>>
>> Cron log shows:
>>
>> Mar 7 15:40:02 web /usr/sbin/cron[66012]: (root) CMD (/etc/rsync/sync)
>>
>> BUT, output contains nothing (assuming I reset it to that before cron
>> executes the job.
>>
>> Any ideas or a better place to ask this or a way to debug it?
>

> Common problem would be rsync is not in $PATH and you didn't specified
> full path. Try either adding it into PATH on the crontab, or using
> full path and see if that helps?
>
> Cheers,

_______________________________________________

0 new messages