Kaynağa Gözat

[bin] Fix mail sync scripts

Colin Powell 2 yıl önce
ebeveyn
işleme
d7ae82cb1a
2 değiştirilmiş dosya ile 20 ekleme ve 6 silme
  1. 12 4
      bin/.bin/checkmail
  2. 8 2
      bin/.bin/syncmail

+ 12 - 4
bin/.bin/checkmail

@@ -1,7 +1,15 @@
 #!/bin/sh
+AFEW_SERVICE="afew"
+MBSYNC_SERVICE="mbsync"
+NOTMUCH_SERVICE="notmuch"
 
-afew -m -n
-mbsync -a
-notmuch new
-afew -t -n
+if [ $(pidof $AFEW_SERVICE) ] || [ $(pidof $MBSYNC_SERVICE) ] || [ $(pidof $NOTMUCH_SERVICE) ]; then
+    echo "Checkmail is already running."
+else
+    echo "Checking for new mail"
+    afew -m -n
+    mbsync -a
+    notmuch new
+    afew -t -n
+fi
 exit 0

+ 8 - 2
bin/.bin/syncmail

@@ -1,2 +1,8 @@
-#!/bin/sh
-muchsync muchsync1.local
+#!/bin/bash
+
+if [ $(pidof muchsync) ]; then
+    echo "Checkmail is already running."
+else
+    echo "Checking for new mail"
+    muchsync muchsync1.local
+fi