[mail] Add password unlock step to mailsync
This commit is contained in:
parent
fb4d909b7c
commit
9897728497
1 changed files with 9 additions and 1 deletions
10
bin/mailsync
10
bin/mailsync
|
@ -1,5 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
die () {
|
||||
2>&1 echo "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
maildir=~/mail
|
||||
mailboxes=$(find "$maildir" -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch -printf '%f\n')
|
||||
|
||||
|
@ -16,7 +21,10 @@ fi
|
|||
trap "rm -f $LOCKFILE; exit" INT TERM EXIT
|
||||
echo $$ > "$LOCKFILE"
|
||||
|
||||
for m in $mailboxes; do
|
||||
# Try a single short sync to test password availability
|
||||
mbsync "$(echo "$mailboxes" | head -n 1)" || die "Please unlock password database"
|
||||
|
||||
for m in $(echo "$mailboxes" | tail -n+2); do
|
||||
mbsync "$m" &
|
||||
sleep 1
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue