]> git.friedersdorff.com Git - max/dotfiles.git/commitdiff
Synchronize mail after quitting mutt
authorMaximilian Friedersdorff <maxf130@gmail.com>
Thu, 19 May 2016 09:48:28 +0000 (10:48 +0100)
committerMaximilian Friedersdorff <maxf130@gmail.com>
Thu, 19 May 2016 09:48:28 +0000 (10:48 +0100)
offline_mail/.mutt/colors.mutt
offline_mail/.mutt/mutt_with_mbsync.sh

index af89e6f97402cdbe25fe33c692889b0c682947d1..2c48840b32f536202a57bc158a8a3d2655f00def 100644 (file)
@@ -1,4 +1,4 @@
-color index default red ~D
 color index green default ~Q
+color index default red ~D
 
 color status white brightblack
index 5b90e46e1cb53b431a9b485f88640601b86dc505..1b6c355982623a53beee4a541be11bf16936ad10 100755 (executable)
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
 
-PID="/var/run/user/1000/sync_maiboxes.pid"
+PID="/var/run/user/1000/sync_mailboxes.pid"
 LOG="/home/max/.local/var/log/mutt_mbsync.log"
 touch $LOG
 
@@ -8,25 +8,32 @@ clean_up()
 {
   kill -TERM $(cat $PID)
   rm $PID
+
+  sync_mailboxes
   exit
 }
 
 trap clean_up SIGTERM SIGHUP SIGINT
 
-sync_maiboxes()
+sync_mailboxes()
+{
+  /usr/bin/mbsync -c /home/max/.mbsync/personal.mbsync -a >> $LOG 2>&1
+  /usr/bin/mbsync -c /home/max/.mbsync/personal-gmail.mbsync -a >> $LOG 2>&1
+  /usr/bin/mbsync -c /home/max/.mbsync/student.mbsync -a >> $LOG 2>&1
+  /usr/bin/mbsync -c /home/max/.mbsync/musoft.mbsync -a >> $LOG 2>&1
+}
+
+sync_mailboxes_loop()
 {
   while true
   do
-    /usr/bin/mbsync -c /home/max/.mbsync/personal.mbsync -aq
-    /usr/bin/mbsync -c /home/max/.mbsync/personal-gmail.mbsync -aq
-    /usr/bin/mbsync -c /home/max/.mbsync/student.mbsync -aq
-    /usr/bin/mbsync -c /home/max/.mbsync/musoft.mbsync -aq
+    sync_mailboxes
 
     sleep 250
   done
 }
 
-sync_maiboxes& >> $LOG 2>&1
+sync_mailboxes_loop& >> $LOG 2>&1
 echo $! > $PID
 /usr/bin/mutt