The following is mostly taken from the example published at https://mkaz.com/2013/07/03/run-script-at-start-on-debian/
Write an init.d script according to the the dependency-booting specification (see at https://wiki.debian.org/LSBInitScripts).
, say it foo.sh
. Place the script under /etc/init.d
.
ln -s /root/scripts/foo.sh /etc/init.d/foo
Update the runlevel directories under /etc/rc*
:
update-rc.d foo defaults