Ubuntu – init.d script not executing

bootscriptUbuntu

I have a script on ubuntu that I put in /etc/init.d. It has 0755 permissions, and I can run it manually both executing it and sourcing it, with good results. I have symlinks in both /etc/rc3.d and /etc/rc5.d, both named S01raid, both pointing to the init.d script. When I reboot the machine however, the script doesn't seem to run. I dont see the array mounted or even running, nor do I see the monitor daemon running on the ps -A output

What am I missing here?

script contents:

#!/bin/sh -e
modprobe raid5
mdadm --assemble --scan
mdadm --monitor --scan --daemonize --delay 120 --program /etc/mdadm/scram.sh
mount -t xfs /dev/md0 /mnt/

Best Answer

I'd suggest you follow the standard tools to run a script at startup.

Look at this answer to a similar question, where I listed down the steps to follow. Also, as mentioned by another user on that question, for testing purposes I'd just place the commands in /etc/rc.local, before the "exit 0".

You also need to ensure any services this depends on are already started when this is run. Check the logs in /var/log for any error messages.

Related Question