Run instantaneously a command when fill a given percentage of the disk #62

Open
opened 2025-01-25 01:08:42 +01:00 by Benjamin_Loison · 1 comment
Currently I use crontab:
0 18 * * * PERCENT=$(df -h / | tail -n 1 | tr -s ' ' | cut -d ' ' -f5 | sed 's/\%//g'); if [[ $PERCENT -ge 97 ]]; then echo 'Running out of storage!'; fi

In the context of Benjamin_Loison/android_packages_apps_Recorder/issues/4 where potentially record everyday may exceed this threshold once and compress but the next day exceed again, hence should look for another solution but it may be clearer that running out of disk despite compressing if it notifies more quickly.

+2

<details> <summary>Currently I use <code>crontab</code>:</summary> ``` 0 18 * * * PERCENT=$(df -h / | tail -n 1 | tr -s ' ' | cut -d ' ' -f5 | sed 's/\%//g'); if [[ $PERCENT -ge 97 ]]; then echo 'Running out of storage!'; fi ``` </details> In the context of [Benjamin_Loison/android_packages_apps_Recorder/issues/4](https://codeberg.org/Benjamin_Loison/android_packages_apps_Recorder/issues/4) where potentially record everyday may exceed this threshold once and compress but the next day exceed again, hence should look for another solution but it may be clearer that running out of disk despite compressing if it notifies more quickly. +2
Benjamin_Loison changed title from Run a command when fill a given percentage of the disk to Run instantaneously a command when fill a given percentage of the disk 2025-01-25 01:08:54 +01:00
Author
Owner

Maybe inotify may help.

Maybe inotify may help.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Benjamin_Loison/linux#62
No description provided.