login community faq

I followed the instructions on http://docs.webfaction.com/software/mongodb.html and the mongodb service stops after the ssh window is closed. How do I get it to continue running after the ssh connection is closed?

asked Oct 05 '12 at 19:10

gmaniac's gravatar image

gmaniac
153


If you launch it with an ampersand on the end of the line then it will launch as a background process, e.g. using the example from the docs:

1
nohup $HOME/webapps/application/mongodb-linux-architecture-version/bin/mongod --auth --dbpath $HOME/webapps/application/data/ --port number &

You could set up a cron job to ensure it's running every so often, which will then serve a double purpose of ensuring it's running and launch it initially (or launch it manually initially then set up a cron job).

You can find information on using cron on WebFaction at the following link (which also contains a link for more advanced cron help): http://docs.webfaction.com/software/general.html#scheduling-tasks-with-cron

answered Oct 05 '12 at 20:18

waynek's gravatar image

waynek ♦♦
954

edited Oct 05 '12 at 21:21

Thank you for responding so quickly, but that didn't work appending & at the end. The services ends once I close the SSH connection. I have not tried setting up a Cron job yet. It might take me a little while, I am not sure how to set that up yet. Do you have an example of how to setup Cron for running/starting MongoDB every so often?

Oh and I would like to thank you for using examples in your post it really helps me.

(Oct 05 '12 at 21:09) gmaniac gmaniac's gravatar image

Sorry, I left out something at the beginning. You will need to run it through the "nohup" command so that processes started during the session don't receive a SIGHUP signal when the session closes. I will edit the answer also to include documentation for cron.

(Oct 05 '12 at 21:17) waynek ♦♦ waynek's gravatar image
Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×18
×5

Asked: Oct 05 '12 at 19:10

Seen: 409 times

Last updated: Oct 05 '12 at 21:21

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited