]> git.friedersdorff.com Git - max/dotfiles.git/blob - offline_mail/.local/bin/mutt
Use combined local drafts folder that is not synced
[max/dotfiles.git] / offline_mail / .local / bin / mutt
1 #!/bin/bash
2
3 PID="/home/max/.local/var/run/sync_mailboxes.pid"
4 LOG="/home/max/.local/var/log/mutt_mbsync.log"
5 touch $LOG
6
7 clean_up()
8 {
9   kill -TERM $(cat $PID)
10   rm $PID
11
12   sync_mailboxes
13   exit
14 }
15
16 trap clean_up SIGTERM SIGHUP SIGINT
17
18 sync_mailboxes()
19 {
20   /usr/bin/mbsync -c /home/max/.mbsync/personal.mbsync -a >> $LOG 2>&1
21   /usr/bin/mbsync -c /home/max/.mbsync/personal-gmail.mbsync -a >> $LOG 2>&1
22   /usr/bin/mbsync -c /home/max/.mbsync/aber.mbsync -a >> $LOG 2>&1
23 }
24
25 sync_mailboxes_loop()
26 {
27   while true
28   do
29     sync_mailboxes
30
31     sleep 60
32   done
33 }
34
35 sync_mailboxes_loop& >> $LOG 2>&1
36 echo $! > $PID
37 /usr/bin/mutt
38
39 clean_up