#!/usr/bin/env bash
set -euo pipefail

# Force Boston time for the timestamp even if the server is elsewhere
export TZ=America/New_York

OUTDIR="$HOME/html/jupiter"
mkdir -p "$OUTDIR"

stamp="$(date +%y%m%d.%H%M%S)"
outfile="$OUTDIR/jupiter.$stamp.jpg"

# 3 retries, 8s timeout, ignore self-signed cert on LAN cam
wget \
  --tries=3 \
  --timeout=8 \
  --no-check-certificate \
  --quiet \
  -O "$outfile" \
  "https://192.168.1.6:8080/shot.jpg"
