Browse Source

Silence mailsync, so cron doesn't spam e-mails on every update

pull/856/head
jw 2 years ago
parent
commit
367c10ec3f
No known key found for this signature in database GPG Key ID: 89F6F19015860E9C
2 changed files with 4 additions and 5 deletions
  1. +3
    -4
      bin/mailsync
  2. +1
    -1
      bin/mw

+ 3
- 4
bin/mailsync View File

@@ -70,14 +70,13 @@ syncandnotify() {
}

# Sync accounts passed as argument or all.
if [ "$#" -eq "0" ]; then
accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")"
else
if [ "$#" -gt "0" ]; then
for arg in "$@"; do
[ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1
done
accounts=$*
fi
[[ ! $accounts ]] && accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")"

# Parallelize multiple accounts
for account in $accounts; do
@@ -86,7 +85,7 @@ done

wait

notmuch new 2>/dev/null
notmuch new --quiet

#Create a touch file that indicates the time of the last run of mailsync
touch "$lastrun"

+ 1
- 1
bin/mw View File

@@ -262,7 +262,7 @@ togglecron() { cron="$(mktemp)"
sed -ibu /mailsync/d "$cron"; rm -f "$cron"bu
else
echo "Adding automatic mailsync every ${cronmin:-10} minutes..."
echo "*/${cronmin-10} * * * * $prefix/bin/mailsync" >> "$cron"
echo "*/${cronmin:-10} * * * * $prefix/bin/mailsync -q" >> "$cron"
fi &&
crontab "$cron"; rm -f "$cron" ;}



Loading…
Cancel
Save