One more question re: daily chron job...

Jason Holtzapple jasonholtzapple at yahoo.com
Tue May 26 17:32:17 MST 2009


--- On Tue, 5/26/09, Jim March <1.jim.march at gmail.com> wrote:
> Folks,
> 
> Last time we wrestled with this, we learned that Zoneminder
> (camera
> monitor app) can do purges of older files.  Except it
> doesn't work.
> I've tried three times now, it still fills the disk, I'm
> flat sick and
> tired of it.
> 
> There has to be a way in Ubuntu (Jaunty) to do a daily
> purge chron job
> to the effect of:
> 
> ---
> sudo find /media/disk/* -mtime +45 -exec rm {} \;
> ---
> 
> That command works fine, executed manually.  It purges
> files older
> than 45 days on a particular hard disk formatted ReiserFS
> (due to the
> high number of small files).
> 
> Any way I can get it to kick off daily?

Do you see any cron errors in /var/log/syslog when the job starts?

If you're going to use sudo, you'll need to set up NOPASSWD or
something similar in your sudoers file. I'd skip that and just
add a job to your root user crontab:

0 0 * * * find /media/disk -type f -mtime +45 -exec rm -f {} \;

--Jason


More information about the PLUG-discuss mailing list