#!/bin/bash
#description=Checks if the chosen folder is over a certain amount, alerts you if so.
#arrayStarted=true
#name=Warn if Folder too big
#clearLog=true
#noParity=true
# Add more text to name if you need several? Or just add onto the script.
warningMessage="Your appdata folder is getting too big!"
checkedPath="/mnt/disk1/appdata/"
# Size in gigabytes that you want to be warned at and above.
let warningSize=5
# ----------------
let "warningSize = warningSize * 1000000"
# https://stackoverflow.com/a/11518088
duSize=$(du -sk $checkedPath | awk '{print$1}')
if (( duSize > warningSize )); then
/usr/local/emhttp/webGui/scripts/notify -i alert -s "$warningMessage" -d "$(du -hs $checkedPath)"
fi
#echo ${duSize}
#echo ${warningSize}
echo Finished
Works with the User Scripts add-on for scheduling!
Oh, perfect! I didn't know how to send notifications, so this is a great starting point. I'll try to remember to post my final script here in case any one searches for this topic in the future.
Hi!
I have a docker container that slowly fills up a folder, and currently clearing it manually is the best solution while I write a script to handle it for me.
Is there a way to cause a dashboard pop-up if a folder goes above say 5GB used or maybe a % of the disk?
(I searched the forums and didn't see a similar question, sorry if it's a repeat!)