I call the command: node мой путь/index.js& everything starts and gives the process ID, but if I close the Putty window, the process ends, what could be the problem? I start it like with the background, in the end there is &
1 answer
In the background of the current session . As soon as a session is completed, all its processes, including background ones, are terminated.
The easiest way: run through GNU Screen or tmux, the session in which does not depend on the SSH connection.
If without additional funds - you need to unbind the running process from its parent process: demonize it.
And quite in a good way : to make a process out of the process, which will be monitored by an OS-specific mechanism or another service in the OS (some kind of process supervisor): start at startup, restart when it crashes or on request.
|