Monitor server remaining space script

Source: Internet
Author: User

Script for the remaining space on the Monitoring Server:

# Vi size. Sh

Press a or I to enter the editing mode.

#! /Bin/bash

Name = 'hostname'

Date = 'date + % m % d % y'

Size = '/bin/DF-H/home | grep T | awk-f [: ""] +' {print $5 }''
Size2 = '/bin/DF-H/home | grep T | awk-f [: ""] +' {print $5} '| tr-d' %''
Size3 = '/bin/DF-H/home | grep T | awk-f [: ""] +' {print $4 }''

If [$ size2-ge "90"]


Touch/log/size/$ date. Log

Echo "$ name use size $ size">/log/size/$ date. Log
Echo "$ name remained size $ size3">/log/size/$ date. Log

/Usr/bin/mail-s "$ name use size" [email protected] </log/size/$ date. Log


Press ESC to exit the editing mode.

: WQ (save and Exit)

This article is from the "Linux" blog and will not be reproduced!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.