aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2019-05-13 13:31:04 +0800
committerAaron LI <aly@aaronly.me>2019-05-13 13:31:04 +0800
commit0e966018102a8aaee27eda7d85817804d499e8ab (patch)
tree974770c9cb2f7f549e2292f0d6b5c0b6d6a1875e
parent1e82c625808539313df502eb69fd624311b1d68a (diff)
downloaddotfiles-0e966018102a8aaee27eda7d85817804d499e8ab.tar.bz2
bin/get_mail.sh: Simplify and update to use notmuch
-rwxr-xr-x_bin/get_mail.sh32
1 files changed, 5 insertions, 27 deletions
diff --git a/_bin/get_mail.sh b/_bin/get_mail.sh
index a8288cc..25aa1b3 100755
--- a/_bin/get_mail.sh
+++ b/_bin/get_mail.sh
@@ -1,30 +1,8 @@
#!/bin/sh
-#
-# Run the command to get emails, and record its PID, which is used
-# to kill the program before run it again.
-# This is an workaround to solve the stuck issue with `offlineimap`.
-#
-# Command to get emails
-GET_CMD="offlineimap -o -1"
+export PATH=$HOME/bin:$HOME/.bin:$HOME/.local/bin:$PATH
-# PID file
-PID_FILE="${HOME}/.cache/get_mail.pid"
-
-# Log file
-LOG_FILE="${HOME}/.cache/get_mail.log"
-
-
-# Kill the previous process at first.
-# For `offlineimap`, it sometimes just stucks ...
-if [ -e "${PID_FILE}" ]; then
- kill -SIGKILL `cat ${PID_FILE}`
- rm ${PID_FILE}
-fi
-
-if [ -e "${LOG_FILE}" ]; then
- mv ${LOG_FILE} ${LOG_FILE}.old
-fi
-
-${GET_CMD} > ${LOG_FILE} 2>&1 &
-echo $! > ${PID_FILE}
+check-gpg-pass.sh && {
+ mbsync -a
+ notmuch new
+}