Skip to content

Instantly share code, notes, and snippets.

@mrprompt
Last active May 15, 2018 15:27
Show Gist options
  • Save mrprompt/2d87f80b606c49106db64f6756d993e9 to your computer and use it in GitHub Desktop.
Save mrprompt/2d87f80b606c49106db64f6756d993e9 to your computer and use it in GitHub Desktop.
raspberry meteor control photos startup
#!/usr/bin/env bash
SERVER=${1:-192.168.11.200}
PARAMS=${2:-"-d 10 -e 4000 --verbose"}
TODAY=`date +%Y%m%d`
REMOTE_DIR="/home/ftp/storage/meteotux"
trap ctrl_c INT
function ctrl_c() {
echo "** Trapped CTRL-C"
ssh -f SERVER "sh -c 'killall -9 meteotux_pi meteor.sh > > /dev/null 2>&1'"
echo "Creating timelapse"
ffmpeg -r 24 -pattern_type glob -i '*.jpg' -s hd1080 -vcodec libx264 $TODAY.mp4
echo "Exiting..."
exit 0
}
echo "Accessing camera host"
ssh -f $SERVER "sh -c 'cd $REMOTE_DIR; nohup meteor.sh $PARAMS > /dev/null 2>&1 &'"
echo "Creating local directory"
mkdir -p $TODAY; cd $TODAY
echo "Running loop (press Ctrl+C to interrupt):"
while :; do clear; rsync -av --remove-source-files -e ssh $SERVER:$REMOTE_DIR/*.jpg .; sleep 300; done
echo "Done :)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment