AFAIK, there is nothing special about the /etc/init.d directory. That's just where startup scripts are stored
by convention, not
by mandate. I could be mistaken on this ... I've never actually tried placing an init script outside of /etc/init.d It would be simple enough to run a quick test if you wanted to.
But assuming I'm correct about scripts outside of /etc/init.d being allowable:
If you want /root/myscript to run when you hit runlevel 2, 3, and 4 for example, you should be able to do something like this:
Code:
ln -s /root/myscript /etc/rc2.d/S99local
ln -s /root/myscript /etc/rc3.d/S99local
ln -s /root/myscript /etc/rc4.d/S99local
Your /root/myscript file should understand standard startup script options, like "start", "stop", "restart", etc. I suppose if you're only creating an Sxxx link then all it's needs to understand is "start". If you also create a Kxxx script, then it needs to understand "stop".
I find those "update-rc.d" type of wrapper programs to be more trouble than just doing things manually.