tons of misc updates
[distro-setup] / offlineimap-sync
index 21361b90c189114c071c5255f85561b515915980..2b71a6969b0f970df0012e148241b7b140227a54 100755 (executable)
@@ -3,6 +3,9 @@
 set -eE -o pipefail
 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
+# mail-route can get messed up a bit randomly, I don't know why.
+#/b/ds/mail-route up | /b/log-quiet/log-once -1 mail-route
+
 offlineimap -u quiet
 shopt -s nullglob
 
@@ -11,7 +14,7 @@ omv() { # offlineimap mv. move mail files within $src_base/$1 to /m/md/$2
     dst="$2"
     found_files=false
     for x in new cur; do
-        files=("$src_base"/"$src"/$x/*)
+        files=($src_base/"$src"/$x/*)
         if [[ $files ]]; then
             found_files=true
             mv "${files[@]}" /m/md/"$dst"/$x
@@ -36,3 +39,21 @@ if $found_files; then
     # figure out if that is the same speed, or if we can make it faster.
     #mu index &>/dev/null ||:
 fi
+
+
+# qemu-devel is our biggest list by far, so occasionally
+# I want to hop into conversations about our mailing
+# systems there, but I don't need many old messages.
+find /nocow/user/fsfmd/l/qemu-devel/new -type f -mtime +14 -execdir rm -- '{}' +
+
+find /nocow/user/fsfmd/{sec,Spam,Drafts,{rtcc,sysadmin,l/outreachy-mentors}/new} -type f -mtime +100 -execdir rm -- '{}' +
+
+find /nocow/user/fsfmd/log -type f -mtime +300 -execdir rm -- '{}' +
+
+
+# delete based on http://deflexion.com/2006/05/imap-way-of-deleting-message
+sieve-filter -eW -o mail_location=maildir:/nocow/user/fsfmd:LAYOUT=fs:INBOX=/nocow/user/fsfmd/INBOX ~/sieve/fsf.sieve INBOX delete &>>/tmp/fsfsieve.log
+
+# to test new rules, update fsf-test.sieve, run these commands, then copy new fsf-test.sieve to fsf.sieve
+# sieve-filter -o mail_location=maildir:/nocow/user/fsfmd:LAYOUT=fs:INBOX=/nocow/user/fsfmd/INBOX ~/sieve/fsf-test.sieve INBOX &>/tmp/testfsfsieve.log
+# sed -rn '/^Performed actions:/{n;n;p}' /tmp/testfsfsieve.log | sort -u