Skip to content

Instantly share code, notes, and snippets.

@irskep
Created April 22, 2017 04:04
Show Gist options
  • Save irskep/518bd0a00584edc0156268914523eb5d to your computer and use it in GitHub Desktop.
Save irskep/518bd0a00584edc0156268914523eb5d to your computer and use it in GitHub Desktop.
#!/bin/bash
SCREEN_COUNT=0
echo Capture started on `date`
echo Capture started on `date` >> log.txt
trap ctrl_c INT
function ctrl_c() {
echo Capture ended on `date` with $SCREEN_COUNT screens captured.
echo Capture ended on `date` with $SCREEN_COUNT screens captured. >> log.txt
exit
}
mkdir -p ~/timelapse
while true
do
sleep 30
FILENAME=~/timelapse/screen.`date +%s`.jpg
FILENAME2=~/timelapse/camera.`date +%s`.jpg
echo Capturing to $FILENAME
screencapture -C -m -t jpg -x -f $FILENAME
imagesnap -w 1 $FILENAME2
SCREEN_COUNT=$((SCREEN_COUNT+1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment