By using AWS re:Post, you agree to the Terms of Use

Server process run through command do not persist in my Amazon Lightsail Instance

0

I created an Amazon Lightsail Instance of 512MB RAM,

I have got all my production server files installed on my Amazon Lightsail Instance. Then I connected to the instance via SSH. Then I ran my database command in the background via the browser SSH window:

mongod --dbpath=data &

Then I ran my server command in the background:

next start -H <private_ip> -p <port>

Then I closed the browser ssh window. Then, after some time I found that the server was not able to be reached via the url. It was working when I had the ssh window open.

I opened the ssh window again, and did ps to see if the processes were still running. I found that both the database process and the server process were closed.

I want them to persist forever, i.e. the processes shouldn't close because I want to use my website at any time right.

asked 7 months ago56 views
1 Answer
1

Try this, after you start the process:

  1. ctrl+ z
  2. bg
  3. disown -h or disown -a Basically running the process as background.

There are options tmux, nohup, screen, byobu. PS: I am a beginner and I got this info after a bit of googling. I hope it helps. Please ignore if it doesn't or if you know this already

answered 7 months ago
  • Will try it out thanks !

  • Alternatively, use "&" to disconnect the process from the login session.

    'nohup yourprocess &'

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions