[bin] Fixing bin scripts and adding bus check

This commit is contained in:
2025-09-09 14:33:18 -04:00
parent 9941550fa8
commit 8918bdd6b9
5 changed files with 128 additions and 17 deletions

View File

@ -64,7 +64,7 @@ for cam in "${WEBCAMS[@]}"; do
done
# --- Update index.html ---
INDEX_HTML="$BASE_DIR/index.html"
INDEX_HTML="$BASE_DIR/timelapses.html"
# Ensure file exists with basic structure
if [[ ! -f "$INDEX_HTML" ]]; then
@ -87,19 +87,19 @@ fi
# Build new day's section
NEW_SECTION="<h2>$YESTERDAY</h2><ul>"
for link in "${LINKS[@]}"; do
cam=\$(echo "\$link" | cut -d']' -f1 | tr -d '[]')
url=\$(echo "\$link" | awk '{print \$2}')
NEW_SECTION+="<li><a href=\"\$url\">\$cam</a></li>"
cam=$(echo "$link" | cut -d']' -f1 | tr -d '[]')
url=$(echo "$link" | awk '{print $2}')
NEW_SECTION+="<li><a href=\"$url\">$cam</a></li>"
done
NEW_SECTION+="</ul>"
# Insert at the top of <div id="days">
tmpfile=\$(mktemp)
awk -v section="\$NEW_SECTION" '
tmpfile=$(mktemp)
awk -v section="$NEW_SECTION" '
/<div id="days">/ { print; print section; next }
{ print }
' "\$INDEX_HTML" > "\$tmpfile"
mv "\$tmpfile" "\$INDEX_HTML"
' "$INDEX_HTML" > "$tmpfile"
mv "$tmpfile" "$INDEX_HTML"
echo "📝 Updated index with $YESTERDAY timelapses (newest on top)"