Skip to content

Instantly share code, notes, and snippets.

@JonBons
Last active November 20, 2019 23:50
Show Gist options
  • Save JonBons/815a64c1a8fd9a4765e42a76f9e57189 to your computer and use it in GitHub Desktop.
Save JonBons/815a64c1a8fd9a4765e42a76f9e57189 to your computer and use it in GitHub Desktop.
Yi 4K loop recording cleanup/auto-record
#!/bin/sh
cd /tmp/fuse_d/DCIM
storage_space=$(df -k . | tr -s ' ' | cut -d" " -f 5 | tail -n 1 | sed 's/[^0-9]*//g')
latest_dcim=$(ls | tail -1)
cd $latest_dcim
if [ $storage_space -gt 90 ]
then
rm "$(ls -t | tail -1)"
rm "$(ls -t | tail -1)"
/tmp/fuse_d/bootcmd.sh
exit 0
else
/usr/bin/SendToRTOS record
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment