Script to check file size
Hello, we have a server in which a certain file keeps growing in size until it makes the server to crash down.
I want to know if it is possible to make a script that constantly checks the file size and send some kind of alert once it gets a certain size. The alert could be a banner at login or an email sent to some administrator. Do you think it is possible? |
Quote:
|
sure, it is possible, probably you need to configure your cron. But probably you want to check the utility logrotate.
|
I second the recommendation for logrotate. Doesn't matter where the file is located or what type of file it is, logrotate can check it and archive it or remove it depending on just the size of the file. You can also invoke logrotate faster than once per day if the growth of this file is too rapid.
|
Code:
#!/bin/bash |
All times are GMT -5. The time now is 03:15 PM. |