following setup
Start-Stop-Daemon:
do_start
start-stop-daemon -S -m -p $PIDFILE --name myapp --exec /opt/myapp
do_stop
start-stop-daemon -K -R TERM/30/KILL/5 -p $PIDFILE --name myapp
the script I start looks like that:
java -jar ./myapp.jar
so when I start my daemon everything is working fine, PIDFILE is generated. ps aux | grep myapp gives me 2 outputs, one for the daemon and one for the java, as child. If I do want to stop it, only the daemon is stopped the java process keeps running detached from console.
How do I need to change my daemon/script to also term the java application when I stop the daemon?