Article 4ZZRY Bash scripting

Bash scripting

by
nandesuka
from LinuxQuestions.org on (#4ZZRY)
Hello,

for the last 2 days, i've been trying to learn how to script in bash. I want to find every file system that's filled up by more than 20% of its total capacity. If it meets that requirement then it will search for ".log" files older than 3 days, delete the ".log" files and redirect the names of deleted files to a file.

I came up with this for looking up file systems:
df -Th | egrep '[2-9][0-9]% | 100%'

And this for looking up log files, deleting them:
find DIRECTORY -name "*.log" -atime +3 > file.txt; rm *log DIRECTORY

So my question is how can i make it into a script so that it does it automatically for every file system. Cant think of anything. Would appreciate any suggestionslatest?d=yIl2AUoC8zA latest?i=RWkxbADSTb4:POgOjXLtFEM:F7zBnMy latest?i=RWkxbADSTb4:POgOjXLtFEM:V_sGLiP latest?d=qj6IDK7rITs latest?i=RWkxbADSTb4:POgOjXLtFEM:gIN9vFwRWkxbADSTb4
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments