This is a useful tip for my reference. I’ve been creating some startup scripts on my Ubuntu server lately and her are a couple of steps required to get this working.
Write your startup script and place it in /etc/init.d/ directory. Let’s say you called your startup script – myScript. You then install your script by using update-rc.d debian utility:
update-rc.d myScript defaults
Have a look at man update-rc.d for more info.
And finally, you have to make your file executable:
chmod +x myScript
To remove the startup script you need to run:
update-rc.d -f myScript remove