I have the following script:
#!/bin/bash
# wait, just in case hdd md0 in not mountet yet
sleep 30
# write Raid state in log-file
mdadm -D /dev/md0 > /home/main_usr/myScripts/raidHealth.log
#just check if it writes to the file
echo "just a Test" >> /home/main_usr/myScripts/raidHealth.log
I´ve done the following things: 1. made file executable 2. changed owner to root 3. wrote script into crontab (sudo crontab -e | @reboot /home/main_usr/myScripts/checkRaid.sh)
So heres my Problem: When I run the script, everything works just perfect. But when I reboot my Computer the script runs, but my .log file just contains "just a Test". No output of the mdadm-command. I can´t explain why the mdadm-command is empty in this case. Maybe someone can help me out.
I also should mention that I need sudo to run the script (mdadm-command)