4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
5 # mail-route can get messed up a bit randomly, I don't know why.
6 #/b/ds/mail-route up | /b/log-quiet/log-once -1 mail-route
8 for f
in $
(awk '$1 == "localfolders" {print $NF}' ~
/.offlineimaprc
); do
16 if grep -qP '^ *accounts.*fsf' ~
/.offlineimaprc
; then
17 if [[ ! -e /nocow
/user
/.mufsf
]]; then
18 mkdir
-p /nocow
/user
/.mufsf
19 chmod 700 /nocow
/user
/.mufsf
20 mu index
--maildir=/nocow
/user
/fsfmd
24 omv
() { # offlineimap mv. move mail files within $src_base/$1 to /m/md/$2
29 files
=($src_base/"$src"/$x/*)
32 mv "${files[@]}" /m
/md
/"$dst"/$x
37 src_base
=/m
/offlineimap
38 omv
"Sent Items" "Sent"
39 omv INBOX offlineimaptmp
42 sieve-filter
-eW ~
/sieve
/main.sieve offlineimaptmp
&>/dev
/null
43 # the default folder is INBOX for anything leftover
44 omv offlineimaptmp INBOX
45 # remove messages from remote host
47 # this makes us sit and wait when we want to use mu and this is running in a cronjob.
48 # todo: emacs updates the index much faster. what command is it running? I'd like
50 # looks like it might be mu index --lazy-check, but that still takes like 10 seconds,
51 # figure out if that is the same speed, or if we can make it faster.
52 #mu index &>/dev/null ||:
55 # find but ignore directories which dont exist, assuming first args are directories
56 # and a following arg starts with -
60 if [[ $d == -* ]]; then
61 # past dirs, onto options
74 # qemu-devel is our biggest list by far, so occasionally
75 # I want to hop into conversations about our mailing
76 # systems there, but I don't need many old messages.
77 myfind
/nocow
/user
/fsfmd
/l
/qemu-devel
/new
-type f
-mtime +14 -execdir rm -- '{}' +
80 myfind
/nocow
/user
/fsfmd
/{sec
,Spam
,Drafts
,{rtcc
,sysadmin
,l
/outreachy-mentors
}/new
} -type f
-mtime +100 -execdir rm -- '{}' +
82 myfind
/nocow
/user
/fsfmd
/log
-type f
-mtime +300 -execdir rm -- '{}' +
85 # delete based on http://deflexion.com/2006/05/imap-way-of-deleting-message
86 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
88 # to test new rules, update fsf-test.sieve, run these commands, then copy new fsf-test.sieve to fsf.sieve
89 # sieve-filter -o mail_location=maildir:/nocow/user/fsfmd:LAYOUT=fs:INBOX=/nocow/user/fsfmd/INBOX ~/sieve/fsf-test.sieve INBOX &>/tmp/testfsfsieve.log
90 # sed -rn '/^Performed actions:/{n;n;p}' /tmp/testfsfsieve.log | sort -u