title: Cannot create systemd script for Puma
body: <p>I created a service script named <code>"puma.service"</code> in <code>/etc/systemd/system/</code> with the following contents:</p>
  
  <pre><code>[Unit]
  Description=Puma HTTP Server
  After=network.target
  
  [Service]
  Type=simple
  
  User=ubuntu
  
  WorkingDirectory=/home/username/appdir/current
  
  ExecStart=/bin/bash -lc "/home/username/appdir/current/sbin/puma -C /home/username/appdir/current/config/puma.rb /home/username/appdir/current/config.ru"
  
  Restart=always
  
  [Install]
  WantedBy=multi-user.target
  </code></pre>
  
  <p>I enabled the service and when started, I'm getting the following log from systemctl:</p>
  
  <pre><code>● puma.service - Puma HTTP Server
     Loaded: loaded (/etc/systemd/system/puma.service; enabled; vendor preset: enabled)
     Active: inactive (dead) (Result: exit-code) since Wed 2016-12-14 10:09:46 UTC; 12min ago
    Process: 16889 ExecStart=/bin/bash -lc cd /home/username/appdir/current &amp;&amp; bundle exec puma -C /home/username/appdir..
   Main PID: 16889 (code=exited, status=127)
  
  Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Main process exited, code=exited, status=127/n/a
  Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Unit entered failed state.
  Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Failed with result 'exit-code'.
  Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Service hold-off time over, scheduling restart.
  Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: Stopped Puma HTTP Server.
  Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Start request repeated too quickly.
  Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: Failed to start Puma HTTP Server.
  </code></pre>
  
  <p>Although, when I give the command in SSH terminal the server started and was running perfect. Is there any changes I have to make in the service file?</p>
  
  <p><strong>Note:</strong></p>
  
  <ol>
  <li>I have changed the dirnames for your convenience.</li>
  <li>I did some research and the cause of status 127 is due to the executable not in the path. But, I guess that won't be a problem.</li>
  </ol>
  
  <p>Can you shed some light?</p>