Created
November 3, 2019 10:12
-
-
Save aweijnitz/2d102d706b62f193f6fd444ed24ca03c to your computer and use it in GitHub Desktop.
Shell script to run as a cron job and "run command" to prevent motionEyeOS from filling up the /data partition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CURRENT=$(df /data/output | grep /dev | awk '{ print $5}' | sed 's/%//g') | |
THRESHOLD_CLEAN=60 | |
THRESHOLD_FULL=85 | |
if [ "$CURRENT" -gt "$THRESHOLD_CLEAN" ] ; then | |
find /data/output -type f -mtime +3 -exec rm -f {} \; | |
fi | |
if [ "$CURRENT" -gt "$THRESHOLD_FULL" ] ; then | |
rm -rf /data/output/Camera1 | |
curl "https://api.clickatell.com/http/sendmsg?user=motioneye_sms_alert&password=MITT_LOESENORD&api_id=nnn1388&to=MITT_MOBILNUMMER&text=MotionEye_DISK_FULL_ALERT" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment