nohup vs screen — which is better for long running process?

Both have there own + and – :

nohup:

  1. nohup is good to use for running procs in background when proc don’t
    need any user input like httpd server or any other server proc like
    that.
  2. nohup does create log in dir of proc execution. log file name
    default is nohup.out
  3. It avoids proc getting killed due to mistaken
    ctrl+C , ctrl+D . Just a safe guard.
  4. It’s normally installed by default with basic setup. No need to install separately like screen.
  5. It’s functionality is very specific to running a job in background
    and dumping output. Low memory intensive.

screen:

  1. Got to install separately. You can NOT go to a data center or login to
    any box and expect screen is present.
  2. Good to manage multiple terminals on separate subjects and give them name.
  3. Its more of terminal manager and not a command to run a proc for infinite time like nohup.
  4. It’s more suitable if proc need user input. Like install
    scripts, yes/no prompts.
  5. With tones of features, comes it’s memory. But agreed, some are really great features.

To conclude, both are two different things made with different agendas so comparison is difficult.

Cheers!

Leave a Comment