diff options
| author | Robert Günzler <r@gnzler.io> | 2026-04-08 13:18:14 +0900 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2026-04-08 13:18:14 +0900 |
| commit | b61b58ce2c1371d6f904f108fa7feed3abfbe5c7 (patch) | |
| tree | 008a5cf54ecbfffb97ddac30e44c8ab224395ab0 /bin/msmtp-queue | |
| parent | d4620f3ac119263fee90bd819eadaf84fc8d50b7 (diff) | |
*
Automated-commit-by: dots Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to '')
| l--------- | bin/msmtp-queue | 1 | ||||
| -rwxr-xr-x | bin/msmtp-queue-stat | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/bin/msmtp-queue b/bin/msmtp-queue new file mode 120000 index 0000000..2604954 --- /dev/null +++ b/bin/msmtp-queue @@ -0,0 +1 @@ +/usr/share/msmtp/msmtpq/msmtp-queue \ No newline at end of file diff --git a/bin/msmtp-queue-stat b/bin/msmtp-queue-stat new file mode 100755 index 0000000..bb83784 --- /dev/null +++ b/bin/msmtp-queue-stat @@ -0,0 +1,17 @@ +#!/bin/sh +set -eu + +throttle_by=10 +throttle_cookie=/tmp/throttle.msmtp-queue-stat +throttle() { + last_called=$(stat -c %Y $throttle_cookie 2>/dev/null || printf 0) + now=$(date +%s) + touch $throttle_cookie + if [ $((now - last_called)) -gt $throttle_by ]; then + "$@" + else + false + fi +} + +throttle sh -c "msmtpq --q-mgmt -d | grep id= | wc -l | tee $throttle_cookie" || cat "$throttle_cookie" |