How do you gracefully shutdown a Java service from a Bash shell script?

http://stackoverflow.com –
I'm converting a Java REST service from the 'traditional' way -- as a servlet compliant .war that deploys to a multi-tenant app server (Tomcat) -- to a much simpler embedded setup where there is a simple Java main class that starts an embedded http server (Grizzly+Jersey). The one missing piece is the service wrapper. I can manually run the service by doing 'java -jar myservice.jar', but I'd like to implement as a proper Linux background service.
Normally, this is done with a simple Bash shell script that you put in /etc/init.d. I've seen some super simple examples, but they implement shutdow
(HowTos)

Stories similar to How do you gracefully shutdown a Java service from a Bash shell script?

I chose the Java Service Wrapper from tanukisoftware to make daemon service on linux (Ubuntu server 10.10). When I start it via terminal, new process was created and stop immediately, no log was produced.

few months ago I write simple script to check status of some service and when service is down search live process of this service and kill them, then remove pid file and restart service. The problem is that the script is not always able to remove the pid file which results in that the script is not able to restart the service.