I found this in my notes:
Add a program to run at startup in Ubuntu Linux Server via the command line.
1. Login with root access.
Find the location of the program you wish to run at bootup.
For example, MyProgram is located in /home/me/programs/MyProgram
2. We need to create a script file in the init.d folder and we need superuser privileges for that.
2a. Run the command
sudo touch /etc/init.d/RunMyProgram
It’ll prompt you for the root password, enter it. Make sure the file has been created in that directory.
2b. Make the file executable.
sudo chmod +x /etc/init.d/RunMyprogram
3. Open that file in a text editor
4. We’re going to create a simple script that will simply call our program.
Type this bit of code in that text file. Replace the second line with the file path for your program. That is all that should be in the text file.
4a. This script will automatically run as root.
If you want your program to run as a standard unprivileged user, put in a 'su ’ before the second line.
5. We need to assign our script to a certain runlevel (at what state in Linux’s bootup you wish to run the program).
5a. Simply run
sudo update-rc.d /etc/init.d/RunMyProgram defaults
and that will put you at the appropriate runlevels.