Create a date-added script for the top 10 disk space user reports

Source: Internet
Author: User

#!/bin/bash
#Big_User-find Big disk space users in various direcotries
#Parameters for Script
#
Check_directories= "/var/log/home" #direcotries to check
#
##################### #Main script###########################
#
Date= ' Date +%m%d%y ' #Date for report file
exec > Space_file_$data.rpt
#
#
echo "Top Ten Disk Space Usage" #Report Header for Whole report
echo "for $CHECK _directories direcotries"
#
For Dir_check in $CHECK _directories #loop to du directories
Do
echo ""
echo "The $DID _check Directory:" #Title header for each direcotry
#
#Create a listing of top ten disk space users
Du-s $DIR _check 2>/dev/null|sort-rn|sed ' {one, $D; =} ' |sed ' n;s/\n//' |gawk ' {printf $ ":" \ T "$" \ T "$" \ n "} '
#
Done
exec >/tmp/test.txt

Create a script that adds a date to the top 10 disk space users report

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: info-contact@alibabacloud.com 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.