[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Cron not working



On Sun, Jul 12, 2015 at 05:11:21PM +0000, Dan Purgert wrote:
> On Sun, 12 Jul 2015 13:02:43 -0400, Haines Brown wrote:
> 
> > This may be a FAQ, but it has me stumped. I try to do a weekly backup
> > with this, but nothing happens, and there is nothing in syslog:
> > 
> >   # crontab -l 0 4 * * 0 /home/haines/scripts/backup
> > 
> > I can run the script manually with # /home/haines/scripts/backup.
> > 
> > Cron daemon is running:
> > 
> >   $ ps -ef | grep cron | grep -v grep root      8972     1  0 12:37 ?   
> >       00:00:00 cron
> 
> It's most likely that your script is using some environment variable 
> that's not (inherently) present to the cron daemon;  or a pathing issue 
> (e.g. ~/Documents is different to you than it is to the [root] Cron job).

Interesting suggestion. The backup script does the following:

  a) mounts the external drive
  b) sleeps a bit
  c) removes oldest backup with a find command
  d) constructs a backup directory using mkdir
  e) does a backup with the find command
  f) writes to a log using printf
  g) unmounts the backup drive

I don't see how any of this draws on an environment variable. A possible
exception is $(date) and `date +%Y.%m.%d`. I provide full paths in the
script to avoid the other problem.

The backup script is an executable owned by user. 


Reply to: