title: User systemd service restarting only when SSH-ing into the machine
body: <p>I have a strange situation with a web service hosted on a debian instance, that sometimes stops, and does not restart automatically. However, when SSH-ing into the machine, the service seems to restart automatically.</p>
  <p>I originally wanted the service to always be up and restart, could you help me figure out what's wrong ? I may have misunderstood how <code>systemctl --user</code> services are meant to run.</p>
  <p><em>The service in question is a Rails application running with passenger standalone, but I believe the problem might just be a misconfiguration in the systemd file.</em></p>
  <p>My systemd file</p>
  <pre><code># .config/systemd/user/my_service.service
  [Unit]
  Description=passenger with rails server for my_service (production)
  After=syslog.target network.target
  
  [Service]
  Type=forking
  PrivateTmp=yes
  WorkingDirectory=/websites/xxx/current
  
  PIDFile=/websites/xxx/shared/tmp/pids/passenger.8080.pid
  
  ExecStart=/home/outscale/.asdf/shims/bundle exec passenger start /websites/xxx/current
  ExecStop=/home/outscale/.asdf/shims/bundle exec passenger stop /websites/xxx/current
  
  MemoryAccounting=true
  MemoryLimit=3584M
  
  Restart=always
  RestartSec=1
  TimeoutStopSec=30
  KillMode=mixed
  StandardInput=null
  SyslogIdentifier=%p
  
  # Environment
  Environment=&quot;RAILS_ENV=production&quot;
  Environment=&quot;NODE_ENV=production&quot;
  
  [Install]
  WantedBy=default.target
  
  </code></pre>
  <p>I have copied this installed the service using</p>
  <pre><code>systemctl --user daemon-reload
  systemctl --user enable my_service
  
  </code></pre>
  <p>Was I meant to use something else, like <code>systemctl --global enable unit</code> ? I want my service to run with the &quot;outscale&quot; user installing the service (otherwise my version manager asdf does not work as expected)</p>