This link explains init scripts. You probably want to base your script on the ones in /etc/init.d or /etc/rc.d ( one may be a link to the other directory ). There may be some commented lines at the top that determine where the service configuration tool will link them ( I.E. which run levels and what the dependencies are ).
http://www.lysator.liu.se/~forsberg/...nit-files.html
and another link:
http://freebooks.by.ru/view/RedHatLi...d/rhl6u059.htm
The quick & dirty, lazy & wrong way to do it is to have your startup command saved in a simple script and called something like S##tomcat5 and the shutdown script named K##tomcat5 where the ## represents a number which determines the boot order of the script.
I believe that the tomcat service should start after the apache service, so make sure the the S## number is greater then the one for the httpd daemon, and less then the number for the K##httpd service.
Normally the actual script is located in the /etc/init.d directory and the scripts in /etc/init.d/rc.5 are links to the corresponding script in /etc/init.d. So a script called S25httpd will be a link to the httpd script. The K13httpd script will be a link to the same httpd script. (note, I just pulled the numbers 25 and 13 out of the air to make the example clearer )
---
Another place to start the service is to add a line to the rc.local script. You might want to include a test to see if the httpd daemon is running before starting it.
__
If you want to write your own script, look for a script called skeleton in the init.d or rc.d directory and use it as a start. And if possible, use the Service Configuration Tool to produce the links in the runlevel subdirectories.
___
Also google for Tomcat 5. I saw a webpage that contained a lot of information on installing and using Tomcat.
Good Luck!