[Tfug] One more question re: daily chron job...
Choprboy
choprboy at dakotacom.net
Tue May 26 19:36:37 MST 2009
On Tuesday 26 May 2009 17:22, Jim March 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?
>
[user at acme ~]$ crontab -e
:i
0 0 * * * /usr/bin/sudo /usr/bin/find /media/disk/* -mtime +45 -exec rm {} \;
:wq
[user at acme ~]$
Or... run it as root which doesn;t need to be sudo'd:
[root at acme ~]$ vi /etc/cron.daily/cleanup_zoneminder
:i
#!/bin/sh
/usr/bin/find /media/disk/* -mtime +45 -exec rm {} \;
:wq
[root at acme ~]$ chmod 755 /etc/cron.daily/cleanup_zoneminder
[root at acme ~]$
Adrian
More information about the tfug
mailing list