Last active
July 5, 2023 19:11
-
-
Save orjanv/9d3dcaaf766cd0d793ea53c5c678bfd8 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 | |
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