title: Apache jsvc fails to stop daemon
body: <p>I am using a native compiled jsvc to launch a java daemon. I am running this on an openSUSE 32 bit vm. The code implements Apache's daemon interface, and I'm executing the deamon with the following command. </p>
  
  <pre><code>./jsvc -home jre -errfile logs/jsvc.err -pidfile daemon.pid -cp &lt;my_classpath&gt; com.loader.loaderservice.LoaderDaemon
  </code></pre>
  
  <p>It starts and runs without a problem. I can start the daemon as a normal user and as root. However, when I go to terminate the daemon, jsvc kills the process rather than issuing a stop command.</p>
  
  <pre><code>./jsvc -stop -home jre -outfile logs/jsvc.err -errfile logs/jsvc.err -pidfile daemon.pid -cp &lt;my_classpath&gt; com.loader.loaderservice.LoaderDaemon
  </code></pre>
  
  <p>The daemon process dies, but does not execute any of its shutdown steps (for example, it should log, mark a record in the db, etc).  I get the following in the logs/jsvc.err file, and it doesn't write any other logs:</p>
  
  <pre><code>Service exit with return value 143
  </code></pre>
  
  <p>After googling the error, I'm seeing a handful of people who all have seen the same thing, but nowhere can I find a good resolution (http://mail-archives.apache.org/mod_mbox/commons-dev/200401.mbox/%3CPine.GSO.3.96.1040105133739.23375A-100000@merlot.tel.uva.es%3E, <a href="http://www.tek-tips.com/viewthread.cfm?qid=1014679">http://www.tek-tips.com/viewthread.cfm?qid=1014679</a>, <a href="http://threebit.net/mail-archive/tomcat-users/msg03832.html">http://threebit.net/mail-archive/tomcat-users/msg03832.html</a>).</p>
  
  <p><strong>UPDATE:</strong>
  Using Apache's window's service launcher (procrun) I am able to start and stop the service without any problems. The problem appears to be only jsvc related, and only on stopping the daemon.</p>
  
  <p><strong>UPDATE 2:</strong>
  After reading the <a href="http://commons.apache.org/daemon/jsvc.html#Starting_jsvc">http://commons.apache.org/daemon/jsvc.html#Starting_jsvc</a> more carefully, I noticed that the stop tag I'm using issues a kill command pn the process via the pid file I specify. It seems that jsvc doesn't actually stop the daemon gracefully by design. This is consistent with the behavior I'm seeing, as the very verbose stop method isn't writing any messages out.</p>
  
  <pre><code>-stop        stop the service using the file given in the -pidfile option
  </code></pre>
  
  <p>New Questions:</p>
  
  <ul>
  <li>If my java main has implemented the Apache Daemon interface, how do I issue a 'stop' on the running daemon?</li>
  <li>Do I need something other than jsvc (which seems like it's only useful for starting or killing the daemon)?</li>
  </ul>