When creating a new script to be executed at the startup of Ubuntu, create a script in /etc/init.d
For example 'foo', google for examples of startup scripts, can be anything...
Make the script executable: sudo chmod +x foo
And finally update the list of startup scripts: sudo update-rc.d foo defaults
Simple as that.