This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You need to write a shell script and add it to /etc/init.d, and you need to set run level (how you do that varies slightly between different Linux flavors - most of them provide GUI tools for doing this). JBoss AS comes with several such scripts, you could use one of those as a template.