Browse Source

setup some environment vars for the cron job

Some tickets suggest that the mailsync process doesn't have all environ-
ment variables set which are needed. For example:

https://github.com/LukeSmithxyz/mutt-wizard/issues/678
The error messages indicate that for mailsync, `XDG_DATA_HOME` is empty/
unset and hence it cannot resolve the user's gnupg folder.

This commit defines  those variables via the crontab,  which I think are
the relevant ones. Not sure though if these are all we need or if I for-
got some.
pull/680/head
Kr1ss 3 years ago
parent
commit
0b9843893f
No known key found for this signature in database GPG Key ID: 23F078862ACFE50
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      bin/mw

+ 8
- 2
bin/mw View File

@@ -271,10 +271,16 @@ togglecron() { cron="$(mktemp)"
crontab -l > "$cron"
if grep -q mailsync "$cron"; then
echo "Removing automatic mailsync..."
sed -ibu /mailsync/d "$cron"; rm -f "$cron"bu
sed -ibu '/^# mailsync/,/^.*mailsync$/d' "$cron"; rm -f "$cron"bu
else
echo "Adding automatic mailsync every ${cronmin:-10} minutes..."
echo "*/${cronmin-10} * * * * $prefix/bin/mailsync" >> "$cron"
cat <<EOF >>"$cron"
MBSYNCRC=${MBSYNCRC:-$HOME/.mbsynrc}
NOTMUCH_CONFIG=${NOTMUCH_CONFIG:-$HOME/.notmuch-config}
GNUPGHOME=${GNUPGHOME:-$HOME/.gnupg}
PASSWORD_STORE_DIR=${PASSWORD_STORE_DIR:-$HOME/.password-store}
*/${cronmin-10} * * * * $prefix/bin/mailsync
EOF
fi &&
crontab "$cron"; rm -f "$cron" ;}



Loading…
Cancel
Save