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.

질문됨 2년 전418회 조회
1개 답변
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

답변함 2년 전
  • Will try it out thanks !

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

    'nohup yourprocess &'

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인