summaryrefslogtreecommitdiff
path: root/script/with-metanews
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/with-metanews
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/with-metanews')
-rwxr-xr-xscript/with-metanews24
1 files changed, 24 insertions, 0 deletions
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##*:}" \
+ "$@"