Cron Job will not run.

Giorgos Keramidas keramida at
Thu Nov 3 21:17:59 GMT 2005

On 2005-11-03 13:01, Brandon Hinesley <brandonh at> wrote:
>Alex Zbyslaw [mailto:xfb52 at] wrote:
>> Brandon Hinesley wrote:
>>> The script below works perfectly when I run it from a
>>> console, however, nothing at all seems to happen as evidenced
>>> by the backups not being rotated.  I don't know if this makes
>>> a difference, but the "Backup" folder is a file system on an
>>> external hard drive.  I am also using samba to share that
>>> folder as r/o.
>>> [...]
>>> Here's part of my /etc/crontab:
>>> --------------------
>>> SHELL=/bin/sh
>>> PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin
>>> [...]
>>> rsync -av --delete $files/$docs $dbkups/0/
>> This is a FAQ, though I don't know if it's in the FAQ :-)
>> From the command line /usr/local/bin (where rsync lives) is in
>> your path.  From Cron it is not.  Either add it to the crontab
>> or set PATH in your script.  The latter is recommended since
>> the script works whatever the running user has their path set
>> to.  There may be some other path problem I've missed, but this
>> ones sticks out.
> I added /usr/local/bin to /etc/crontab
> PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin
> It's still not working.  It doesn't seem to run anything in the
> script at all; rotations or rsync'n.

Merely adding it as an assignment is not enough for child
processes of the cron script to 'see' the value.  Make sure
you also 'export' the new PATH:

    export PATH

Then the rsync process will use the new PATH.

More information about the freebsd-questions mailing list