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 11if test -f "${HOME}/.env_common"; then 12 source "${HOME}/.env_common" 13fi 14 15# Go to archivebox directory and run scheduled command for supplied 16# feed URL. Send ntfy an error message if it fails. 17cd /naspool/archivebox 18if ! /home/jas/.local/bin/archivebox add --depth=1 "$1" \ 19 >>/naspool/archivebox/logs/schedule.log; then 20 curl \ 21 -H prio:urgent \ 22 -H tags:warning \ 23 -d "Error running archivebox schedule for $1" \ 24 "${NTFY_SERVER}/archivebox_schedule" 25else 26 curl \ 27 -H prio:default \ 28 -H tags:incoming_envelope \ 29 -d "archivebox schedule succeeded: $1" \ 30 "${NTFY_SERVER}/archivebox_schedule" 31fi