5

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/

2 Answers 2

1

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.

0
2

"S01" means it runs pretty early in the boot process. First thing I'd do is make sure that there aren't things that need to run first that are later (have higher numbers).

On my Ubuntu system, sysklogd is S10 and mdadm is S25, so at least make it higher than those so you can see if it logs anything.

You must log in to answer this question.