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 suggestions


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 suggestions