Quote:
Originally Posted by disco
thanks for the link, but this seems to only remove files over n days. What I need to do is when the hard disk is greater the n percent full, remove the oldest files from the directory until the disk is lower than n percent full.
|
Here are some hints you can use to help yourself:
- The following tutorial is a good introduction to shell programming:
http://steve-parker.org/sh/sh.shtml
- To determine whether a partition is more than some pre-determined percentage full, look the output of df(1) & think about how to isolate a value in a particular column (HINT: with awk(1), this is easy...).
- As for how to determine how old files are, look at the manpage for ls(1).
The link provided by
jggimi will help you ferret out the details needed to set up
cron(8) which can automatically call your script on whatever periodic basis you want.