I have a
bash script (
daily.sh) that runs daily as a
cron job for user
pi. Recently, I received an email notification on my RPi that an error had occurred in
daily.sh. It turned out that this email notification was very useful, but I don't understand how this was "triggered" - i.e. what caused it to be sent??
Some background may be useful or relevant:
I've learned today that the
exim4 MTA on my RPi was installed months ago as a Suggested Dependency when the
at utility was installed.
exim4 is not a "default" install - not part of the RPi OS Lite distro I use.
The text of the emailed error message:
/home/pi/daily.sh: line 27: [: !=: unary operator expected
I don't think this is relevant to my question, but I'll mention it "just in case":
As it turns out, this error was not redirected to the
cron_error.log because I mistakenly said,
2 >> instead of
2>> in my
I know that it's possible to declare the
MAILTO variable in a
MAILTO=pi), but there is no such declaration in the
crontab for user
pi (or any other user for that matter). AFAICT there is no default "global" declaration for
cron either. Yet, somehow,
cron knew to send this error message to the inbox for
pi. How did that happen?