Assorted shell and Python scripts
1#!/usr/bin/env bash
2
3set -euo pipefail
4
5# Check if feed URL is supplied.
6if (( "${#@}" == 0 )); then
7 echo "No feed URL has been supplied."
8 exit 1
9fi
10
11# Get Headnet IP address for desktop
12SERVER_IP=$(sudo tailscale status | grep "dietpi" | awk '{print $1}')
13
14# Go to archivebox directory and run scheduled command for supplied
15# feed URL. Send ntfy an error message if it fails.
16cd /naspool/archivebox
17if ! /home/jas/.local/bin/archivebox add --depth=1 "$1" \
18 >> /naspool/archivebox/logs/schedule.log; then
19 curl \
20 -H prio:urgent \
21 -H tags:warning \
22 -d "Error running archivebox schedule for $1" \
23 "http://${SERVER_IP}:8080/archivebox_schedule"
24else
25 curl \
26 -H prio:default \
27 -H tags:incoming_envelope \
28 -d "archivebox schedule succeeded: $1" \
29 "http://${SERVER_IP}:8080/archivebox_schedule"
30fi