summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
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##*:}" \
+ "$@"