问题原文
原帖链接 · Shovals · CC BY-SA 4.0
I have a server with a huge file system that is used for continues writes and reads without hiccups and needs to be active at all times.
My goal is to have a cronjob that deletes empty folders and files based on name and older than X amount of days.
The obvious answer is to use find -name -mtime -delete but it uses too much disk resources and causing IO wait and other programs to miss their checks because of server unresponsiveness.
Is there any easy to use tool that does this kind of work? maybe limit disk usage? something else i haven't thought of?
社区高分解答
原帖链接 · HBruijn · CC BY-SA 4.0
Use ionice to reduce the priority of your find command and minimize the impact on other applications.
ionice -c 3 find -name -mtime -delete
-c 3 is class "idle" and
a program running with idle io priority will only get disk time when no other program has asked for disk IO (for a defined grace period). The impact of idle IO processes on normal system activity should be zero.
If that never happens (likely on a system that sees use 24x7) try for instance -c 2 -n 7 for the lowest best-effort priority
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
