By beginning with #!/bin/sh -e
, you cause your script to run with sh
(bash
is better IMHO), and -e
exits on any error (man set
), so one cannot handle errors. Your script is failing, and cron
is trying to email you the log. cron
can't find a Message Transfer Agent (MTA). Email hasn't been configured on your system, even for local delivery.
Jobs run through cron
, or systemd
startup scripts aren't run in the same runtime environment that you have on your desktop. systemd
startup scripts are run as root
. None of your PATH
changes, or other environment variable settings from ~/.bashrc
are automatically propagated to your cron
job. For example, there's no $DISPLAY
, so GUI programs need special treatment (read man xhost
).
One can set environment variables for all one's cron
jobs in the crontab
file
Read man 5 crontab
.
Look at the results of echo "=== id ===";id;echo "=== set ===";set;echo "=== env ===";env | sort;echo "=== alias ===";alias
in each of your environments.
Since the command
part of the crontab
line is, by default, interpreted by /bin/sh
, which has a simpler syntax than /bin/bash
, I recommend having command
be a call to a bash
script (executable, mounted, starts with #!/bin/bash
) which sets up the environment, then calls the desired program.