The former server disk is full, causing the project a lot of strange problems, such as file upload is not (this very good understanding), and the login code can not be loaded (now still do not know why, the project's CAPTCHA image is only in memory generated BufferedImage object, do not know why and disk-related )
So while today is free, you add the server to listen to the disk usage of the script, after reaching a certain usage rate, will send an email alert, inform the development or operation to deal with the real-time, to avoid unnecessary trouble.
Find a very detailed blog to do a reference:
Http://www.heminjie.com/system/linux/1923.html
The main points are the following points:
1. View the usage of the system disk.
2. Send an email warning if you find that you have exceeded the set threshold.
3. Add Scheduled Tasks to view disk usage on a timed basis.
First, for the 1th, check the disk usage command Everyone may be familiar: Df-h.
The commands here add some options to the command to fetch the information we want directly.
df-h | awk ' Nf>3&&nr>1{sub (/%/, "", $ (NF-1));p rint $NF, $ (NF-1)} '
For the use of awk, refer to the Linux awk command
Then what we need to consider is how to alert us by email, with the SendEmail command in the data.
The detailed usage of the SendEmail command can be consulted in the following: The shell sends the Mail tool sendemail the usage explanation
Finally we add a scheduled task to our script, and the ability to listen for disk usage is implemented.
Linux Listening disk usage