Hi @lidistat67,
The PM2 process shouldn’t terminate itself upon your exit.
Having said that, there is another solution which I believe it’s always considered good practice to be executed and that’s using SCREEN.
This is for situations where you perform a long-running task on a remote machine, and suddenly your connection drops, the SSH session is terminated, and your work is lost.
Starting Linux Screen
To start a screen session, simply type screen in your console:
screen
This will open a screen session, create a new window, and start a shell in that window.
You can start any command there as with your normal shell. Once you do start it and you want to leave the command as it is, you just need to press
CTRL + A
CTRL + D
This will detach your screen session and return you to your initial bash window.
To return to your screen session, you’ll first need to check it’s ID. You can see the ID by executing the below
screen -ls
Then to re-enter your screen session type in
screen -r IDNumberHere
Alternatively, PM2 is the tool for some long-running tasks. I just wanted to present you with an example.
Regards,
KFSys