Taskwarrior + cron + me == edge case

I have a script that goes like this:

#!/bin/bash

# https://stackoverflow.com/a/821419
set -Eeuo pipefail

_SUBJECT='Taskwarrior ghistory.daily'
_TO='me@me.me'
_TMP2=$(mktemp /tmp/tmp.XXXXXXXXXX.log)
_TMP=$(mktemp /tmp/tmp.XXXXXXXXXX.png)
_CMD="/usr/bin/unbuffer /usr/bin/task rc:${HOME}/.config/task/taskrc ghistory.daily -minut_45 end.after:tomorrow-1wk 2> '${_TMP2}'"

/usr/bin/timeout 10s /usr/bin/bash -c "${_CMD}" | ${HOME}/go/bin/textimg -o ${_TMP}
#  tee /dev/tty |

echo "${_CMD}" | 
  mutt -a "${_TMP}" -s "$_SUBJECT" -- $_TO

#timeout 10s 
#  bash -c "unbuffer task rc:/home/dzwiedziu/.config/task/taskrc ghistory.daily -minut_45 end.after:tomorrow-1wk 2> '${_TMP2}'" | 
#  ${HOME}/go/bin/textimg -o ${_TMP};  echo 'unbuffer task rc:/home/dzwiedziu/.config/task/taskrc ghistory.daily -minut_45 end.after:tomorrow-1wk |& tee ${_TMP2}' | 
#  mutt -a "${_TMP}" -s 'task ghistory.daily -minut_45 end.after:tomorrow-1wk' -- me@me.me
cat ${_TMP2}

And this script works perfectly run manually. Gets the report, makes an image, sends it.

But when run from cron the resulting mail reads:

+ set -Eeuo pipefail
+ _SUBJECT='Taskwarrior ghistory.daily'
+ _TO=me@me.me
++ mktemp /tmp/tmp.XXXXXXXXXX.log
+ _TMP2=/tmp/tmp.XIo41GYh7V.log
++ mktemp /tmp/tmp.XXXXXXXXXX.png
+ _TMP=/tmp/tmp.OfzsFRMDhN.png
+ _CMD='/usr/bin/unbuffer /usr/bin/task rc:/home/dzwiedziu/.config/task/taskrc ghistory.daily -minut_45 end.after:tomorrow-1wk 2> '''/tmp/tmp.XIo41GYh7V.log''''
+ /usr/bin/timeout 10s /usr/bin/bash -c '/usr/bin/unbuffer /usr/bin/task rc:/home/dzwiedziu/.config/task/taskrc ghistory.daily -minut_45 end.after:tomorrow-1wk 2> '''/tmp/tmp.XIo41GYh7V.log''''
+ /home/dzwiedziu/go/bin/textimg -o /tmp/tmp.OfzsFRMDhN.png
Error: must need input texts.

The log file and the output image are empty.

More info:

  • user crontab
  • crontab line (time changes for testing): 49 21 * * * bash -x ~/full/path/to/the/script/taskwarrior_ghistory_daily_mail.sh