0

I am running two scripts

# Script 1
nohup sh {command} &

and the nohup.out is having all logs in details (for script 1)

# Script 2 
nohup sh {command} > {log_path} 2>&1 &

But nohup.out having only limited log as listed below (for script 2),

## Script2 output
   Shutdown message has been posted to the server.
   Server shutdown may take a while - check logfiles for completion 

How can i generate all logs by using script 2 format in nohup.out itself .

fantaghirocco
  • 4,761
  • 6
  • 38
  • 48
Amit
  • 7
  • 5
  • 1
    Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Jun 20 '17 at 13:43
  • I usually ask my shell/nohup questions at [Unix & Linux Stack Exchange](http://unix.stackexchange.com/). – jww Jun 20 '17 at 13:44
  • Looks like script 2 errors are overriding. Try removing error redirection and check. – Skanda Jun 20 '17 at 15:49

1 Answers1

1

If you want to have both files (nohup.out and {log_path}) you can try:

((nohup {command}) > >(tee {log_path}) 2> >(tee {log_path}))>> nohup.out 

the first part of the command line is explained here.

After this, you only have to redirect (append) output to nohup.out.

limaia
  • 96
  • 4