Shell Contact 2

Source: Internet
Author: User
Tags inode usage

See if there are any custom users (ordinary users) on your Linux system, and if so, how many are there?

[email protected] ~]# cat 6.sh

#/bin/bash

N= ' awk-f: ' $3>=500{print '/etc/passwd |wc-l '

If [$n-gt 0];then

echo "$n Common users"

Else

echo "No common users"

Fi

Write a shell script that detects all disk partition usage and inode usage and logs to a log file named after today's date, sending you an email notifying you when a partition capacity or Inode usage is greater than 85%.

#bin/bash
disk_usize= ' df-h |awk ' {print $ ' |sed s#%# #g '
inode_usize= ' df-i |awk ' {print $ ' |sed s#%# #g '
date= ' DATE +%f '
Log=${date}.log
df-h > $LOG
df-i >> $LOG
For i in $DISK _usize $INODE _usize;
if [$i-ge]; Then
echo "Space more than 85%" |mail-s "warnning" 22222222@qq. com
Else
Echo OK
fi
Done

Shell Contact 2

Related Article

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.