Skip to content

Instantly share code, notes, and snippets.

@orjanv
Last active July 5, 2023 19:11
Show Gist options
  • Save orjanv/9d3dcaaf766cd0d793ea53c5c678bfd8 to your computer and use it in GitHub Desktop.
Save orjanv/9d3dcaaf766cd0d793ea53c5c678bfd8 to your computer and use it in GitHub Desktop.
#!/bin/bash
LOGFILE='logfile'
TIMEFORMAT='%Y-%m-%d-%H%M'
URL='https://webkamera.atlas.vegvesen.no/kamera?id='
# Declare the locations and their webcam id in an associated array (Thanks BASH 4)
declare -A PLACES
PLACES=( \
[bleik]=1335902_1 \
[kjoelhaagen]=1037564_1 \
[giaeverbukta]=914512_1 \
[tverrforbindelsen]=1017478_1 \
[kleivodden]=791209_1 \
[bo]=1134205_1 \
)
# Check if folders exists
for key in ${!PLACES[@]}; do
if [ ! -d "${key}" ]; then
mkdir ${key}
fi
done
# Grab road webcam images every ten min (600 seconds)
while true
do
for key in ${!PLACES[@]}; do
wget -a $LOGFILE -O ${key}/$(date +${key}_$TIMEFORMAT.jpg) $URL${PLACES[${key}]}
done
sleep 600
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment