How can I keep my server running when I power down the computer where I have set up the ssh session

Posted February 8, 2016 15.3k views

I have never set up a server before but since Parse announced that they are closing down I thought I might give it a shot. I have followed along with this tutorial and have managed to migrate my Parse database across to digital ocean.

When I call npm run start everything works fine. I can query for data and create new objects all from my iOS app. But there is just one problem. How do I keep the server up and running even when the computer where the ssh session started has been powered down?

When I call npm run start this is what gets logged in terminal:

> parse-server-example@1.0.0 start /var/www/parse
> node index.js

[TypeError: Cannot read property 'Kerberos' of undefined]
DATABASE_URI not specified, falling back to localhost.
parse-server-example running on port 1337.

I know that this is probably a noob question and yes my knowledge is quite limited, so if you could help me then that would be great!

Thanks for your time!

  • Hi, I have no experience with parse, but if it cant run as a service you might have to run it with screen. So ir you screen something you do:
    screen start /var/www/parse

    Then when you are ready to turn off your PC, do: CTRL+AD ( )

    Then the next time you ssh into your server and do: screen -r
    (r for resume)

  • PS! Some times you will be “Locked out” of screen, maybe you got disconnected.

    screen -list

    shows the screens with PID, then you can do (if you have only one):
    screen -d -r

    Or if you have multiple screen, where the number is your PID:
    screen -d -r 96847

    If you want to connect two monitors to one screen I think you can do it with:
    screen -x 96847

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.

Submit an Answer
2 answers

First, your link to the tutorial is broken. If you use this DO tutorial at Step 3, your output will look similar, except for the “type error”. If you want to keep testing in this mode while your console is disconnected, try

nohup npm start &

The nohup command will try to run the command without a tty (see man nohup). The output will usually be in a file named ‘nohup.out’ where you started the command.

by Brennen Bearnes
Parse is a Mobile Backend as a Service platform. In January of 2016, Parse announced that its hosted services would shut down within a year. In order to help its users transition away from the service, Parse has released an open source version of its backend, called Parse Server. This guide supplements the official documentation with instructions for installing the Parse Server module on an Ubuntu 14.04 system, such as a DigitalOcean Droplet.

To keep your node process running use forever