]> git.friedersdorff.com Git - max/dotfiles.git/commitdiff
Script for launching mutt while running mbsync
authorMaximilian Friedersdorff <maxf130@gmail.com>
Fri, 13 May 2016 14:21:35 +0000 (15:21 +0100)
committerMaximilian Friedersdorff <maxf130@gmail.com>
Fri, 13 May 2016 14:21:35 +0000 (15:21 +0100)
offline_mail/.mutt/mutt_with_mbsync.sh [new file with mode: 0755]

diff --git a/offline_mail/.mutt/mutt_with_mbsync.sh b/offline_mail/.mutt/mutt_with_mbsync.sh
new file mode 100755 (executable)
index 0000000..d243110
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+PID="/var/run/user/1000/sync_maiboxes.pid"
+
+clean_up()
+{
+  kill -TERM $(cat $PID)
+  rm $PID
+  exit
+}
+
+trap clean_up SIGTERM SIGHUP SIGINT
+
+sync_maiboxes()
+{
+  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
+
+    sleep 250
+  done
+}
+
+sync_maiboxes&
+echo $! > $PID
+/usr/bin/mutt
+
+clean_up