title: Shiny Server - Active: inactive (dead)
body: <p>Couple of days back I created an instance in AWS with CentOS - MySQL - R - Shiny-Server. The shiny-server is a free version. I loaded my app, data into MySQL.  My app ran without a glitche for two days.  Since yesterday afternoon, I am getting a "Failed to connect: message" from Safari.  When I explored I figured out why shiny-server got stopped, I got the following message:</p>
  
  <pre><code>systemctl status shiny-server -l
  ● shiny-server.service - ShinyServer
     Loaded: loaded (/etc/systemd/system/shiny-server.service; enabled; vendor preset: disabled)
     Active: inactive (dead) since Wed 2016-06-29 02:51:11 UTC; 35s ago
    Process: 3567 ExecStopPost=/usr/bin/sleep 5 (code=exited, status=0/SUCCESS)
    Process: 3565 ExecStartPost=/usr/bin/sleep 3 (code=exited, status=0/SUCCESS)
    Process: 3557 ExecStart=/usr/bin/bash -c /opt/shiny-server/bin/shiny-server --pidfile=/var/run/shiny-server.pid &gt;&gt; /var/log/shiny-server.log 2&gt;&amp;1 (code=exited, status=0/SUCCESS)
   Main PID: 3276 (code=exited, status=0/SUCCESS)
  
  Jun 29 02:51:03 ip-172-31-8-158.ap-southeast-1.compute.internal systemd[1]: Starting ShinyServer...
  Jun 29 02:51:11 ip-172-31-8-158.ap-southeast-1.compute.internal systemd[1]: Started ShinyServer.
  </code></pre>
  
  <p>When i checked the /var/log/shiny-server.log i am getting the following error.</p>
  
  <pre><code>^[[32m[2016-06-29 02:51:03.902] [INFO] shiny-server - ^[[39mShiny Server v1.4.2.786 (Node.js v0.10.40)
  ^[[32m[2016-06-29 02:51:03.903] [INFO] shiny-server - ^[[39mUsing pidfile /var/run/shiny-server.pid
  ^[[32m[2016-06-29 02:51:03.904] [INFO] shiny-server - ^[[39mUsing config file "/etc/shiny-server/shiny-server.conf"
  ^[[31m[2016-06-29 02:51:03.940] [ERROR] shiny-server - ^[[39mError loading config: run_as directive appears too many times (/etc/shin$
  ^[[32m[2016-06-29 02:51:03.941] [INFO] shiny-server - ^[[39mShutting down worker processes
  </code></pre>
  
  <p>When I removed the comment on the PIDfile line got the following error:</p>
  
  <pre><code>Job for shiny-server.service failed because a configured resource limit was exceeded. 
  </code></pre>
  
  <p>Going by examples here at SO i tried doing the following:</p>
  
  <p>Commented out the line <code>PIDfile=/var/run/shiny-server.pid</code> and changed the <code>Type=forking</code> from <code>simple</code> in the /etc/systemd/system/shiny-server.service file.  Stop, start, restart shiny-server with commenting out, commenting in the pid file didn't seem to work.</p>
  
  <p>Tried adding a link <code>ln -s shiny-server.service /systemd/system/multi-user.target.wants</code> but got a message file already exits.  Not sure how to start the server again.</p>