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

view full story

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)