strange error when run from cron

John Van Essen vanes002 at umn.edu
Mon Oct 30 22:48:53 GMT 2006


On Tue, 31 Oct 2006, Jason Cox <jason.cox at multiskilled.com.au> wrote:
> Hi all,
>             I have the following in a cron job    
> /usr/bin/rsync -ub --suffix=~$(date +%F) /Data/Jobs/ /Data/Backups/Jobs/ -razv --no-whole-file  --ignore-errors partial
>   
> Problem is that when the command is run on the command line everything
> works. However, when its in a cron job it fails with the following,
>   
> /bin/sh: -c: line 0: unexpected EOF while looking for matching `)'
> /bin/sh: -c: line 1: syntax error: unexpected end of file
>   
> Anyone seen this before or able to put some light on the problem?

Cron treats '%' as a special character.  From the crontab man page:

     The sixth field of a line in a crontab file is a string that
     is  executed  by the shell at the specified times. A percent
     character in this field (unless escaped by \) is  translated
     to a NEWLINE character.

HTH.

    John



More information about the rsync mailing list