Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The following question has been asked millions of times (be patient towards it please :-)).. Why O why - can't I find ONE SIMPLE, CONCLUSIVE answer? - Would be highly appreciated!

  • Is running a program (What_ever_job.EXE file) in ssh as : "./What_ever_job &" enough to keep it running if my own computer is shut down and ssh is closed? If not - what is the PRECISE (Please!...) way to run it?

No "Screen" please, I have seen something called "nohup" (?) - how do I write the commend?

Thanking you a lot on advance, Erez.

share|improve this question

migrated from stackoverflow.com Sep 11 '12 at 14:55

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 1 down vote accepted

The "simple conclusive" answer is screen. I know you've said you don't want screen, but I'll give you the simple steps anyway:

  1. Log in to the remote machine using SSH
  2. Run screen (your command window will look like it's been cleared)
  3. Run whatever command you'd like. No need to use &
  4. Press Ctrl-A, then the D key

You'll be disconnected from screen, and your command window will look like it did when you logged in, though the process will still be running. Using screen also gives you the advantage of being able to reconnect to the running process after disconnecting your remote machine, which nohup will not allow.

As far as using nohup goes, I haven't actually used it, but the syntax appears to be simply nohup yourcommand &. It's worth pointing out that the Wikipedia article on nohup offers a number of other alternatives you might want to try out, such as VNC if it's available, or start-stop-daemon on a Debian-based system.

EDIT: If you'd like to start the process in a single line, you can use screen -dmS name yourcommand, where "name" can be anything, and is simply the name screen uses to refer to the background session, and "yourcommand" is the command you want to run in the background.

share|improve this answer
    
Great answer, thanks. –  user1611107 Sep 10 '12 at 19:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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