Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
Keeping a linux process running after I logout

I made a Code jar and I want to run the Code on a server linux, I want to close the session between me and the server, is there a way to keep the Code running after closing the session with the server?

share|improve this question

marked as duplicate by Michael Hampton, Bart De Vos, John Gardeniers, mulaz, HopelessN00b Oct 9 '12 at 5:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
For a quick test, nohup java ... -jar Code.jar & should get you started. –  Henk Langeveld Aug 24 '12 at 8:28
    
    
that what I was looking for, thanks –  Engineer Aug 24 '12 at 9:41
add comment

2 Answers

You could try

nohup java -jar YourCode.jar &

(the ampersand sends the process in the background, nohup makes your process not exit together with the shell.)

share|improve this answer
add comment

For a quick test nohup is okay. But if you want to be safe you should use tools like start-stop-daemon (on a debian/ubuntu box) for example.

With it it is easy to write your own initscript. You can safley terminate your application on system shutdown. Like closing Database connections, Closing Transactions and so on. You can start your Process on system start. You can chroot your Process (if wanted) You can switch to a special process user, so it won't run under root. and so on.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.