You are not logged in.
I have a cron job running as root every week.
It executes a script which simply does:
OUTPUT=$(mdadm -D /dev/md127)
echo -e "To:whatever@email.com\nFrom:...\nSubject:...\n\n$OUTPUT" | msmtp "whatever@email.com"
Emailing works, but whenever the script runs as root from the cron job, I get a blank email. I can jam whatever else I want into the email body, but OUTPUT is always blank. I even added a 2nd/3rd attempt to re run the mdadm detail and it still comes back blank.
If I sudo ./script.sh I get an email with the OUTPUT correctly populated. Does anyone know why a regular cron job (/etc/cron.d/report) doesn't work correctly?
Offline