title: How to convert an existing Java application to a SYS V service (daemon)
body: <p>I have a Java application, to start it I use</p>
  
  <blockquote>
    <p>java -jar myapp.jar</p>
  </blockquote>
  
  <p>To stop it I use CTRL+C.</p>
  
  <p>Now I need to convert that application to something that I can start with:</p>
  
  <blockquote>
    <p>/etc/init.d/myapp start</p>
  </blockquote>
  
  <p>And I can stop with:</p>
  
  <blockquote>
    <p>/etc/init.d/myapp stop</p>
  </blockquote>
  
  <p>The problem is all about saving the PID of the process, I think I saw somewhere a recipe for doing this, I don't remember where and I'm not able to find it.</p>
  
  <p>I saw that there is a project called <a href="http://wrapper.tanukisoftware.org/doc/english/download.jsp" rel="noreferrer">Java Server Wrapper</a>, but I look for something free that does not limit memory usage. And I think that this work could be done in a single bash script.</p>