Skip to content

Instantly share code, notes, and snippets.

@wopfel
Created August 23, 2016 17:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wopfel/9e38db3e059f5d6b5b2d01ee8bf3ab15 to your computer and use it in GitHub Desktop.
Save wopfel/9e38db3e059f5d6b5b2d01ee8bf3ab15 to your computer and use it in GitHub Desktop.
Save a webcam picture every x seconds (suitable for a timelapse). Created on a Raspberry Pi 3 running Arch Linux.
#!/bin/bash
# Exit script if /mnt is not mounted somewhere
# Prevents filling the root filesystem (/)
if ! mountpoint /mnt ; then
>&2 echo "Error: No mountpoint."
exit 1
fi
# Endless loop
while true; do
name=`date +'%Y-%m-%d_%H%M%S'`
fswebcam -r "1280x720" -v -F 1 -S 35 --no-banner - > /mnt/$name.jpg
cp /mnt/$name.jpg /mnt/aktuell.jpg
echo Sleeping...
sleep 30
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment