#!/bin/bash

# ------------------------------------------------------------------------------+
#                   HECK FILE SYSYTEM INODE BY THRESHOLD                        |
#   Filename: ck_fs_inode.sh                                                    |
#   Desc:                                                                       |
#      The script use to check file system inode by threshold                   |
#      Once usage of the inode beyond the threshold, a mail alert will be sent. |
#      Deploy it by crontab. e.g. per 15 min                                    |
#   Usage:                                                                      |
#      ./ck_fs_inode.sh <percent> </filesystem [/filesystem2]>                  |
#                                                                               |
#   Author : Kael_Wang                                                          |
#   Blog   : https://www.kael.wang                                               |
# ------------------------------------------------------------------------------+
#
# -------------------------------
#  Set environment here
# ------------------------------

if [ -f ~/.bash_profile ]; then
    . ~/.bash_profile
fi

export host=`hostname`
export mail_dir=/usr/local/bin
export mail_list='kael@kael.wang'
export mail_fm='sd168_zabbix@aspirecn.com'
tmpfile=/tmp/ck_fs_inode.txt
alert=n

# --------------------------------
#  Check the parameter
# --------------------------------

max=$1

if [ ! ${2} ]; then
    echo "No filesystems specified."
    echo "Usage: ck_fs_inode.sh 85 / /opt"
    exit 1
fi

# --------------------------------
#  Start to check the disk space
# --------------------------------

while [ "${2}" ]
    do
        percent=`df -i ${2} | tail -1 | awk '{print $5 }' | cut -d'%' -f1`
        if [ "${percent}" -ge "${max}" ]; then
            alert=y
            break
        fi;
        shift
    done;

# ------------------------------------------------------------------------
#  When a partition was above the threshold then send mail with df output
# ------------------------------------------------------------------------

if [ ! "${alert}" = 'n' ];then
    df -i >$tmpfile
    mail_sub="Dangerous!!!Disk Inode usage beyond the threshold ${max} on ${host}."
    $mail_dir/sendEmail -s 127.0.0.1 -u ${mail_sub} -f $mail_fm -t $mail_list -o message-file=${tmpfile}
fi;

exit;

定时任务添加

*/15 * * * * ./ck_fs_inode.sh 85 / /opt
分类: 发行通用

14 条评论

https://forum.trudesk.io/ · 2026-08-30 05:02

References:

Casino club https://forum.trudesk.io/

dok.kompot.si · 2026-09-22 03:00

References:

Spielhalle mit sofortüberweisung dok.kompot.si

onlinevetjobs.com · 2026-09-22 09:59

References:

Einzahlung mit sofort casino onlinevetjobs.com

https://pbase.com/ · 2026-09-22 20:22

References:

Echtgeld casino sofortüberweisung https://pbase.com/

test-sida.noads.biz · 2026-09-23 04:01

References:

Casino auszahlung sofort test-sida.noads.biz

iwlnx.com · 2026-09-23 05:04

References:

Online casinos sofortüberweisung iwlnx.com

$1 payid pokies · 2026-09-23 08:49

References:

Best payid pokies $1 payid pokies

www.8njy.com · 2026-09-23 09:02

References:

Sofortüberweisung Casino Anleitung http://www.8njy.com

bbs.abcdv.net · 2026-09-23 10:37

References:

Einzahlung mit sofort casino bbs.abcdv.net

casino auszahlung sofort · 2026-09-23 12:49

References:

Neue casinos mit sofortüberweisung https://fzquan8.cn/home.php?mod=space&uid=163683

t.044300.net · 2026-09-23 17:28

References:

Casino mit sofortüberweisung http://t.044300.net/home.php?mod=space&uid=3112878

发表回复

Avatar placeholder

您的邮箱地址不会被公开。 必填项已用 * 标注