Hi,
I am currently checking the df on a server and if a disk is over a certain threshold, an email is sent out to alert others. However, this is run every minute; I do not want the email to be sent out continuously if a hard disk is running out of space. I would like my script to keep checking as normal, however if it sends an email it sets a flag to 1 (meaning that an email was sent) and if the flag remains 0 then no email was sent before, so then when it checks again if the HDD space is high yet has the same value as before - no email is sent. But if the value is different, then the email is sent.
Any idea on how I can do this please?
So far I have got my original script - checks df and emails if the threshold is reached. I have written another script which copies the df in a text file and then compares current with previous.
However then I am lost - nothing is working and I need help!
Thanks!
I am currently checking the df on a server and if a disk is over a certain threshold, an email is sent out to alert others. However, this is run every minute; I do not want the email to be sent out continuously if a hard disk is running out of space. I would like my script to keep checking as normal, however if it sends an email it sets a flag to 1 (meaning that an email was sent) and if the flag remains 0 then no email was sent before, so then when it checks again if the HDD space is high yet has the same value as before - no email is sent. But if the value is different, then the email is sent.
Any idea on how I can do this please?
So far I have got my original script - checks df and emails if the threshold is reached. I have written another script which copies the df in a text file and then compares current with previous.
However then I am lost - nothing is working and I need help!
Thanks!