[Tfug] Cron job in Ubuntu - something is wrong :( - halp?

Robert Hunter hunter at tfug.org
Thu Feb 5 20:57:57 MST 2009


On Thu, Feb 5, 2009 at 5:01 PM, Jim March <1.jim.march at gmail.com> wrote:
> Great.  But I can't have the disk fill up, so I have a cron job set to
> do a purge of files older than 90 days.  It's not working.

A few suggestions.

First, any output from your cron job should get mailed to the owner
(presumably root in this case).  These mails may give you an
indication of what is going wrong.

Second, you probably don't want to use a wildcard this way in your
find command, because the shell will  try expand it, which may be
problematic for various reasons.  You can probably avoid the wildcard
altogether, but if you feel that you must use it, then use a quoted
pattern (e.g., with the -name option).

Third, bundle up all your purge-related commands into a single script
and then invoke the script from cron.  This will allow you to debug
your script independently of cron, and will make your crontab easier to
read and maintain.

-- 
RH




More information about the tfug mailing list