Skip to content

Instantly share code, notes, and snippets.

@aweijnitz
Created November 3, 2019 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aweijnitz/2d102d706b62f193f6fd444ed24ca03c to your computer and use it in GitHub Desktop.
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
#!/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