Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

363
Vistas
Start systemd user service from Rails

I need to start a systemd service from Ruby on Rails. My ruby code is using backticks to call systemctl:

`systemctl --user start myservice`

It's not working and I think it's to do with the user that command is executed by. Rails is running on Passenger and the user for that should be the same as my service.

I've also tried alternative ways to launch a subprocess

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

(This should be a comment rather than an answer, but I'm still building 'reputation' points, so...)

If Passenger has the same UID that myservice needs to run, then that's not where the problem lies. Nor are the other ways of launching a child likely to change the outcome.

I suggest capturing the output of the subprocess as follows: systemctl --user start myservice > /tmp/systemctl.output 2>&1 and then inspecting the output file after the subprocess fails.

over 4 years ago · Santiago Trujillo Denunciar

0

I was able to solve the issue by telling the shell where to find the correct DBUS for the user. I set the environment variable XDG_RUNTIME_DIR to the location of DBUS for the user, 1001 in my case. Check echo $UID to find user id, I couldn't use this inline.

`export XDG_RUNTIME_DIR="/run/user/1001" && systemctl --user start myservice`

Thanks to D.j. Molny for the initial sign post and NeilCasey for the remainder

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda