summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-08-30 10:29:47 -0600
committertjpcc <tjp@ctrl-c.club>2023-08-30 10:29:47 -0600
commit77ac83e700415cdbd4635eae91e79f99312ea240 (patch)
tree65205fbf85c2ba6bf7712f65af49eca564c49365 /script
Initial commit
* iris support copied in from iris-news * a new slog backend * "metabackend" wraps and routes between multiple backends based on the groups they support * better logging than iris-news ever had
Diffstat (limited to 'script')
-rwxr-xr-xscript/mtin3
-rwxr-xr-xscript/with-metanews24
2 files changed, 27 insertions, 0 deletions
diff --git a/script/mtin b/script/mtin
new file mode 100755
index 0000000..3c4883d
--- /dev/null
+++ b/script/mtin
@@ -0,0 +1,3 @@
+#!/usr/bin/env sh
+
+exec $(dirname $0)/with-metanews rtin
diff --git a/script/with-metanews b/script/with-metanews
new file mode 100755
index 0000000..7d1e8cc
--- /dev/null
+++ b/script/with-metanews
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+if [[ -z "$METANEWS_LOG" ]]; then
+ METANEWS_LOG="/dev/null"
+fi
+
+$(dirname $0)/metanews >>"$METANEWS_LOG" 2>/dev/null &
+serverpid="$!"
+
+while [[ ! -e ~/.metanews-server ]]; do
+ sleep 0.1
+done
+addr="$(cat ~/.metanews-server)"
+
+function cleanup {
+ rm ~/.metanews-server
+ tail --pid $serverpid -f /dev/null
+}
+trap cleanup EXIT
+
+env \
+ NNTPSERVER="${addr%%:*}" \
+ NNTPPORT="${addr##*:}" \
+ "$@"