In /etc/inet.d directory you can place your script.
You can use update-rc.d to add the script to your startup properly. You can just place your own symbolic links in each /etc/rc#.d directory; however this is what update-rc.d is for.
Choosing a index which is lower in number than what you want to run before will mean that your script will run in advance of those other ones.
Perform the following check in a command line, here's my example result:
Code:
ls /etc/rc*
/etc/rc.local
/etc/rc0.d:
K02mediatomb K20openbsd-inetd README S15wpa-ifupdown S30urandom S35networking S60umountroot
K20gmediaserver K74bluetooth S10unattended-upgrades S20sendsigs S31umountnfs.sh S40umountfs S90halt
/etc/rc1.d:
K02mediatomb K20acpi-support K20kerneloops K20rsync K20speech-dispatcher K80cups S30killprocs S70pppd-dns
K15pulseaudio K20gmediaserver K20openbsd-inetd K20saned K74bluetooth README S70dns-clean S90single
/etc/rc2.d:
README S20gmediaserver S20openbsd-inetd S25bluetooth S50pulseaudio S50saned S70pppd-dns S98mediatomb S99grub-common S99rc.local
S20fancontrol S20kerneloops S20speech-dispatcher S50cups S50rsync S70dns-clean S90binfmt-support S99acpi-support S99ondemand
/etc/rc3.d:
README S20gmediaserver S20openbsd-inetd S25bluetooth S50pulseaudio S50saned S70pppd-dns S98mediatomb S99grub-common S99rc.local
S20fancontrol S20kerneloops S20speech-dispatcher S50cups S50rsync S70dns-clean S90binfmt-support S99acpi-support S99ondemand
/etc/rc4.d:
README S20gmediaserver S20openbsd-inetd S25bluetooth S50pulseaudio S50saned S70pppd-dns S98mediatomb S99grub-common S99rc.local
S20fancontrol S20kerneloops S20speech-dispatcher S50cups S50rsync S70dns-clean S90binfmt-support S99acpi-support S99ondemand
/etc/rc5.d:
README S20gmediaserver S20openbsd-inetd S25bluetooth S50pulseaudio S50saned S70pppd-dns S98mediatomb S99grub-common S99rc.local
S20fancontrol S20kerneloops S20speech-dispatcher S50cups S50rsync S70dns-clean S90binfmt-support S99acpi-support S99ondemand
/etc/rc6.d:
K02mediatomb K20openbsd-inetd README S15wpa-ifupdown S30urandom S35networking S60umountroot
K20gmediaserver K74bluetooth S10unattended-upgrades S20sendsigs S31umountnfs.sh S40umountfs S90reboot
/etc/rcS.d:
README S13pcmciautils S25brltty S37apparmor S47lm-sensors S55urandom S70x11-common
Scripts with "S" in front of them are startup scripts.
Scripts with "K" in front of them are shutdown scripts.
Say I want to run something before S25bluetooth, but I require S20gmediaserver to be running. Well, I can create a symbolic link (or install via update-rc.d) a script link prepended with S21, S22, S23, or S24 and it will run in the appropriate time.
Notice next that the S25bluetooth and S20mediaserver run only in runlevels 2, 3, 4, and 5. This is actually pretty typical of most systems for scripts that are intended for all user environments. Therefore when you install the script using update-rc.d, you choose 2, 3, 4, and 5 as the runlevels you wish to install it for.