I have a simple node.js script that accepts console commands using readline. I've set it up to run as a systemd service (on Debian 9):

Description=Web Game Server

ExecStart=/usr/bin/node /var/www/index.js


When running directly from the console with node index.js I'm able to send commands to it through the console. Is there any way to do this while it's running as a service?


Because it is now running as a systemd service, I don't think you can connect it to a console directly. You need some form of interprocess communication, such as:

  • TCP Socket server
  • UNIX socket
  • FIFO (named pipe)

The 'socat' utility can be useful to run in the console. It can connect to the service using one of the above protocols, and provide normal readline facilities to the user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.