aboutsummaryrefslogtreecommitdiff
path: root/scripts/mailing-list-member-retirement
diff options
context:
space:
mode:
authorMichael Weiss2020-08-08 16:30:26 +0200
committerMichael Weiss2020-08-08 16:44:59 +0200
commitfdd945ab9f62b80fad370a6469c35a2eb6aba7e7 (patch)
treea0ff873e9046053cb739b6df6c98dcceb104afe0 /scripts/mailing-list-member-retirement
parent03ecabacc697f96629aa94727260e37df11b7b6c (diff)
scripts/mailing-list-member-retirement: Add a Bash script to find inactive list members
Might make sense to implement that part in Go as well, but that would make the binary less flexible (e.g. [0] for statistics). [0]: ./mailing-list-active-members -mbox fsi.mbox -since 2019-08-01 2> /dev/null | sort | uniq -c | sort -h
Diffstat (limited to 'scripts/mailing-list-member-retirement')
-rwxr-xr-xscripts/mailing-list-member-retirement/find-inactive-members.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/mailing-list-member-retirement/find-inactive-members.sh b/scripts/mailing-list-member-retirement/find-inactive-members.sh
new file mode 100755
index 0000000..b61da1f
--- /dev/null
+++ b/scripts/mailing-list-member-retirement/find-inactive-members.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+set -eu -o pipefail
+
+#readonly LIST_NAME="$1"
+#readonly SINCE="$2"
+
+readonly MBOX="$1" # /var/lib/mailman/archives/private/fsi.mbox/fsi.mbox
+readonly LIST_MEMBERS_FILE="$2" # list_members fsi > members.txt
+readonly SINCE="$3"
+
+readonly TMPDIR="$(mktemp -d --suffix=find-inactive-members)"
+readonly ACTIVE_MEMBERS_FILE="active-members.txt"
+readonly ALL_MEMBERS_FILE="all-members.txt"
+
+./mailing-list-active-members -mbox "$MBOX" -since "$SINCE" 2> /dev/null \
+ | sort -u > "$TMPDIR/$ACTIVE_MEMBERS_FILE"
+
+sort "$LIST_MEMBERS_FILE" > "$TMPDIR/$ALL_MEMBERS_FILE"
+
+echo "Inactive members:" >&2
+
+diff "$TMPDIR/$ALL_MEMBERS_FILE" "$TMPDIR/$ACTIVE_MEMBERS_FILE" \
+ | grep -E "^< " | sed "s/^< //"
+
+rm "$TMPDIR/$ACTIVE_MEMBERS_FILE"
+rm "$TMPDIR/$ALL_MEMBERS_FILE"
+rmdir "$TMPDIR"