Page 1 of 1

Use VLC from node app started by linux service

Posted: 02 Dec 2023 10:53
by Laurent17044
Hello,

I have a raspberry with a node server which, via endpoint, should start vlc with RC interface. It works in dev on Windows. It works when, on Raspberry Linux I start Node server with console. As I want the node server to start on Linux startup, I had a service which starts node script. Then, VLC cannot be started anymore, I get error:

{"errno":-111,"code":"ECONNREFUSED","syscall":"connect","address":"::1","port":4212}

This is the service used on linux

[Unit]
Description=Description

[Service]
User=root (I tried different user without any success)
WorkingDirectory=/var/www/html/screenwise/backend
ExecStart=npm run live-prod (I also tried with absolute path to npm)
StandardOutput=file:/var/www/html/screenwise/backend/node-logs.log
StandardError=file:/var/www/html/screenwise/backend/node-logs.log
Restart=always

[Install]
WantedBy=multi-user.target

Thanks for your help

Re: Use VLC from node app started by linux service

Posted: 02 Dec 2023 14:25
by Rémi Denis-Courmont
Whatever is throwing that error (not VLC) is ostensibly failing to connect to TCP port 4212 on loopback. Not much to be said. Only you know your setup.

Re: Use VLC from node app started by linux service

Posted: 02 Dec 2023 14:49
by Laurent17044
No specific setup so far, what I don't understand is why I don't have this error when node is started manually from console and I got the error only when node is started from service.

Any reason why a process started from service couldn't access local port 4212 whereas manually it could ?

Have you any idea about what I could check to go ahead ?

Thanks,
Laurent.

Re: Use VLC from node app started by linux service

Posted: 02 Dec 2023 16:27
by Rémi Denis-Courmont
Again, only you know your system. Anyone else can only give you the basic answer: either nothing is listening on that port, or you have some local security rules that block connections.

Re: Use VLC from node app started by linux service

Posted: 02 Dec 2023 16:30
by Laurent17044
hi hi thanks ;-) That's why I came ;-)

'nothing is listening on that port' only when node app is started by service, if started manually from terminal it works

I have the default debiand install on rasperry, i didn't change anything

Re: Use VLC from node app started by linux service

Posted: 02 Dec 2023 20:16
by Rémi Denis-Courmont
This is not a Node nor RaspBerry Pi support forum (and even there, I doubt you'll get help with such a vague problem description).