If you want to try the DIY way, you can place a startup script in your /etc/init.d directory as said here.
http://www.ghacks.net/2009/04/04/get-to-know-linux-the-etcinitd-directory/
However, to implement a clean yourScript stop
command, I would recommend that you split your functionality into a launcher and a daemon, and make your launcher able to start or communicate with your existing daemon in order to send orders to it. Then your startup script would only invoke your launcher, which in its turn would start a new daemon, or send orders to the existing one.