shell script - how to check file size
I have a file that's supposed to be growing in size 24/7. I want to check every 10 minutes via cron that it's actually growing. If not, send an email. Does anyone know how to write a script to do that?
Use the du command to get the file size and save the current size in a save file. At boot initialize the file size in the save file to 0 with a script in rc.local. Each 10 minutes have a cron job issue a du command, check the size against the size in your save file and if > then overwrite the save file with the new du value. If not > then send the email.
Faster and simpler:
This will give you the file size of the file you are interested in monitoring.
Write this value it to a txt file.
Every 10 mins - run the du command above and compare the value returned from it to the value in the text file we wrote to earlier.
If the values are different - overwrite it.
Else - fire a mail to the concerned person(s)
|All times are GMT -5. The time now is 05:35 AM.|