There's a couple of places you can do this:
/etc/init.d (and then making a link to /etc/rc[runlevel].d - usually 2) works pretty well - so you can specify start up and shut down bits in there.
That's kind of an old way (though oh so very easy). You can also do something with upstart. Look at this page (look at the "Writing Jobs" section).
The big gotcha - the path is normally not quite what you'd expect. So I'd suggest running something along the lines of "echo $PATH > /init_path" from whatever script first to see if you might have an issue (check /init_path and see what's in there.. perfectly safe to remove this file). While it's easy to specify paths in your script, it's worth setting the PATH variable accordingly as anything run from whatever script may also need things in PATH.