An Interest In:
Web News this Week
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
April 5, 2022 09:59 am GMT
Original Link: https://dev.to/akhileshthite/how-to-keep-ec2-instance-running-after-ssh-is-terminated-45k8
How to keep EC2 instance running after SSH is terminated?
In this blog post, I'm going to list a few commands that will help you to keep the EC2 instance running after SSH is terminated.
Author
Linux & Mac users
First, Log in to the server with your SSH key.
- To keep the server running in background, use the following command.
screen -d -m
Let's assume you have a python web application, then your command would look like this:
screen -d -m python app.py
Or if you're using node, then your command would look like this:
screen -d -m npm start
- To list the available screens, use the following command.
screen -ls
- To restart the session, use the following command.
screen -r [session restart]
- To quit the session, use the following command.
screen -X -S [session you want to kill] quit
Windows (PuTTY) users
First, SSH into your remote box. Type screen
, then start the process you want.
Press
Ctrl-A
thenCtrl-D
. This will detach your screen session but leave your processes running. Now, you can log out of the remote box.If you want to come back later, log on again and type
screen -r
, this will resume your screen session and you can see the output of your process.
Thank you!
Original Link: https://dev.to/akhileshthite/how-to-keep-ec2-instance-running-after-ssh-is-terminated-45k8
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To