Hello, i’m new in VPS and also here in Digital Ocean.

Situation: I have a MEAN Stack one-click app. If access my droplet via Putty and start my app, it will run. But if I close Putty my app just shut down.

Question: How can i keep my app running after close Putty?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

You could use screen :))

  • Thanks! It works!
    For people who has the same problem, just follow steps to use screen:

    First of all install screen

    sudo apt-get install screen
    

    Now you can start a new screen session by just typing screen at the command line. You’ll be shown some information about screen. Hit enter, and you’ll be at a normal prompt.

    To disconnect (but leave the session running)

    Hit Ctrl + A and then Ctrl + D in immediate succession. You will see the message [detached]
    
    

    Thats’s it! After message [detached] your app will be running after you close putty.

    Some extra commands

    To reconnect to an already running session

    screen -r
    

    To reconnect to an existing session, or create a new one if none exists

    screen -D -r
    

    To create a new window inside of a running screen session

    Hit Ctrl + A and then C in immediate succession. You will see a new prompt.
    

    To switch from one screen window to another

    Hit Ctrl + A and then Ctrl + A in immediate succession.
    

    To list open screen windows

    Hit Ctrl + A and then W in immediate succession
    

    font: http://www.howtogeek.com/howto/ubuntu/keep-your-ssh-session-running-when-you-disconnect/

Submit an Answer