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?
Script to check file size
-
- Posts: 135
- Joined: 2014/06/17 21:50:37
Re: Script to check file size
Start with:
$ stat /path/to/file -c %s
$ stat /path/to/file -c %s
-
- Posts: 10642
- Joined: 2005/08/05 15:19:54
- Location: Northern Illinois, USA
Re: Script to check file size
What file?
If it is a log file, use logrotate.
If it is not a log file, a simple cron job should be able to do what you want.
If it is a log file, use logrotate.
If it is not a log file, a simple cron job should be able to do what you want.