nullstalgia Posted August 4, 2022 Share Posted August 4, 2022 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!) Quote Link to comment
trurl Posted August 4, 2022 Share Posted August 4, 2022 7 minutes ago, nullstalgia said: write a script You can do notification from a script Quote Link to comment
nullstalgia Posted August 4, 2022 Author Share Posted August 4, 2022 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. Quote Link to comment
trurl Posted August 4, 2022 Share Posted August 4, 2022 also https://linux.die.net/man/1/inotifywait Quote Link to comment
nullstalgia Posted August 5, 2022 Author Share Posted August 5, 2022 #!/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! 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.