mirror of
https://github.com/The-Repo-Club/DotFiles.git
synced 2025-02-07 04:54:18 -05:00
51 lines
1.1 KiB
Bash
Executable File
51 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# -*-coding:utf-8 -*-
|
|
# Auto updated?
|
|
# Yes
|
|
#File :
|
|
# file_name
|
|
#Author:
|
|
# The-Repo-Club [wayne6324@gmail.com]
|
|
#Github:
|
|
# https://github.com/The-Repo-Club/
|
|
#
|
|
# Created:
|
|
# Thu 20 January 2022, 03:50:10 PM [GMT]
|
|
# Modified:
|
|
# Fri 21 January 2022, 02:29:56 PM [GMT]
|
|
#
|
|
# Description:
|
|
# Check for disk useage
|
|
#
|
|
|
|
# Max % that the disk can do until notifying you.
|
|
MAX_USAGE=50
|
|
|
|
# Time in seconds between checks/messages.
|
|
# Common values:
|
|
# 300 = 5 mins
|
|
# 600 = 10 mins
|
|
# 1800 = 30 mins
|
|
# 3600 = 1 hour
|
|
|
|
TIME_IN_BETWEEN=600
|
|
|
|
while true; do
|
|
|
|
# Get % of disk usage
|
|
USAGEROOT=`df -hl | awk '/^\/dev\/nvme0n1p3/ { sum+=$5 } END { print sum }'`
|
|
USAGEHOME=`df -hl | awk '/^\/dev\/nvme0n1p4/ { sum+=$5 } END { print sum }'`
|
|
|
|
# If current usage is higher than max usage
|
|
if [[ $USAGEROOT -gt $MAX_USAGE ]] ; then
|
|
twmnc --title "Disk Usage High on /" --content "Reached ${USAGEROOT}%"
|
|
fi
|
|
if [[ $USAGEHOME -gt $MAX_USAGE ]] ; then
|
|
twmnc --title "Disk Usage High on /home" --content "Reached ${USAGEHOME}%"
|
|
fi
|
|
|
|
# Wait until next check/message
|
|
sleep $TIME_IN_BETWEEN
|
|
done
|
|
|