title: How to make an upstart service to Rserve?
body: <p>I need to start and keep running the <code>rserve</code> from <code>R</code>.</p>
  
  <p>I have these lines in my <code>rserve.r</code> file:</p>
  
  <pre><code>library(Rserve)
  Rserve()
  </code></pre>
  
  <p>So, I'm trying to do something like this in my upstart script:</p>
  
  <pre><code>description "Rserve service"
  author      "Valter Silva"
  
  start on filesystem or runlevel [2345]
  stop on shutdown
  
  respawn
  
  script
      echo $$ &gt; /var/run/rserve.pid
      exec /usr/bin/R /home/valter/R/rserve.R &gt;&gt; /home/valter/test2.log
  end script
  
  
  pre-start script
      echo "[`date`] Rserve Starting" &gt;&gt; /var/log/rserve.log
  end script
  
  pre-stop script
      rm /var/run/rserve.pid
      echo "[`date`] Rserve Stopping" &gt;&gt; /var/log/rserve.log
  end script
  </code></pre>
  
  <p>I know that the service runs because of the output of my file <code>test2.log</code>. But it runs only once. What should I do to keep it running ?</p>