Last active
February 28, 2018 22:26
-
-
Save slavaaaaaaaaaa/5799915 to your computer and use it in GitHub Desktop.
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 | |
| LOCATION=/home/pi/vids | |
| PART=/ | |
| while :; do | |
| TEMP=$(/opt/vc/bin/vcgencmd measure_temp) | |
| DATE=$(date +"%m-%d-%y-%T") | |
| echo "! $DATE-$TEMP.h264 starting..." | |
| sudo raspivid -t 1200000 -o $LOCATION/$DATE-$TEMP.h264 | |
| DISKUSAGE=$(df -h $PART | grep dev | awk '{ print $5}' | sed 's/%//g') | |
| echo "! $DATE-$TEMP.h264 done at $(date +"%m-%d-%y-%T"), disk at $DISKUSAGE." | |
| if [ $DISKUSAGE -ge 99 ] | |
| then | |
| if [ $LOCATION == "/media/vids" ] | |
| then | |
| echo "!! Out of space! Bye!" | |
| break; | |
| fi | |
| echo "!! Switching to USB drive" | |
| LOCATION=/media/vids | |
| PART=/media | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment