From 79a5a257246746b2b8c433c86f10bce7b6d6028f Mon Sep 17 00:00:00 2001
From: Jeffrey Serio <hyperreal@moonshadow.dev>
Date: Tue, 8 Apr 2025 06:53:32 -0500
Subject: [PATCH] Add archivebox_schedule

---
 shell/archivebox_schedule | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100755 shell/archivebox_schedule

diff --git a/shell/archivebox_schedule b/shell/archivebox_schedule
new file mode 100755
index 0000000..7aaf4d1
--- /dev/null
+++ b/shell/archivebox_schedule
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+# Check if feed URL is supplied.
+if (( "${#@}" == 0 )); then
+    echo "No feed URL has been supplied."
+    exit 1
+fi
+
+# Go to archivebox directory and run scheduled command for supplied
+# feed URL. Send ntfy an error message if it fails.
+cd /naspool/archivebox
+if ! /home/jas/.local/bin/archivebox add --depth=1 "$1" \
+    >> /naspool/archivebox/logs/schedule.log; then
+    curl \
+        -H prio:urgent \
+        -H tags:warning \
+        -d "Error running archivebox schedule for $1" \
+        http://100.64.0.15/archivebox_schedule
+fi