删除cron计划中的文件(Delete files on cron schedule)

编程入门 行业动态 更新时间:2024-10-16 22:23:56
删除cron计划中的文件(Delete files on cron schedule)

我在那个删除cron上查了谷歌 - 我有:

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

但它没有用,因为它应该用dslcart-(date)删除所有旧文件。 我不知道我在哪里可以出错?

任何见解将不胜感激。

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.

最满意答案

为什么不写一个shell脚本甚至更简单,一个Perl脚本作为删除这些文件功能的理由? 这样,每次此事件触发时,您都可以更好地控制功能和输出。 这使您无需等待cron事件即可测试功能。 你只需从你的cron调用脚本。

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.

更多推荐

本文发布于:2023-07-04 17:08:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1026957.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   计划   cron   schedule   files

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!