开发者

Delete files on cron schedule

I looked up google on that delete cron --开发者_运维百科 I have that:

17 13 * * * root find /backups/dslcart-* -mtime +6 -exec rm {} \;

But it isn't working as it is supposed to delete all older files with dslcart-(date). I am not sure where I could go wrong with this?

Any insight would be appreciated.


Why not write a shell script or even easier, a Perl Script to act as your liason for the function of deleting those files? This way you have more control over function and output everytime this event fires off. And this allows you test your function without waiting on your cron events. You'll simply call the script from your cron.


I use this (for my 'amavis' user) to clean up quarantined spam files older than 30 days on my mail server:

0 1 * * * find /var/lib/amavis/virusmails -ctime +30 -and -type 'f' -exec rm {} \;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜