Run automatically program on startup under linux ubuntu

Create a script or a program that has to be started automatically with the start of Ubuntu. Make it executable and place it into /etc/init.d/ directory.

sudo mv /filename /etc/init.d/
sudo chmod +x /etc/init.d/filename 
sudo update-rc.d filename defaults 

Script should now start on boot