You are not logged in.

#1 2022-12-05 02:56:59

Registered: 2015-04-22
Posts: 20

Mdadm from cron job gives no stdout/stderr

I have a cron job running as root every week.

It executes a script which simply does:

OUTPUT=$(mdadm -D /dev/md127)
echo -e "\nFrom:...\nSubject:...\n\n$OUTPUT" | msmtp ""

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 ./ 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?


Board footer

Powered by FluxBB