linux- mind a mind to write about

# 1. Reprinted https://www.cnblogs.com/zq-inlook/p/3577003.html

 

nohup command and its output file                                                                                                                                                                                        

  Today deployed on linux wdt program, executed on the SSH client ./start-dishi.sh, successful start, after closing SSH client programs running simultaneously terminated, how can we ensure that the introduction of the SSH client programs It has been enforced? Find information through the Internet, find the need to use nohup command.
The perfect solution: nohup ./start-dishi.sh> output 2> & 1 &

Now under the command of the above explanation

Use: Do not hang up the run command.
Syntax: nohup Command [Arg ...] [ &]
Description: nohup command to run specified by the Command parameter and any related Arg parameters of command, ignore all hang (SIGHUP) signals. The program runs in the background using nohup command after logout. To run a background in nohup command, add & (representation "and" sign) to the end of the command.

There are three commonly used operating system flow:
  0: standard input stream stdin
  . 1: standard output stream stdout
  2: standard error stream stderr
  When we generally use> console.txt, actually 1> console.txt usage omitted; <console.txt, actually 0 <console.txt usage will be omitted.
 
 
Here come to the question:
>nohup ./start-dishi.sh >output 2>&1 &
Explanation:
 1. With & command line, even if the terminal (terminal) closed, the computer crashes or the program is still running (provided that you submit to the program on the server); 
 2.2> 1 & meaning 
  This means that the standard error (2) redirected to the standard output (1), and the output standard output file import and inside, so the result is the standard error and standard output files are imported output inside. As to why you need to redirect standard error to standard output of the reason, it boils down to no buffer to standard error, and stdout there. This will lead to> output 2> output file output is opened twice, while stdout and stderr will cover the competition, this is certainly not what I want the door. 
  That's why someone would write: Reason nohup ./command.sh> output 2> output of the error 
==================================================================================
Finally talk about the role of / dev / null file, which is a bottomless pit, anything can be directed to here, but it can not be opened. It is generally a great stdou and stderr when you do not care can be directed to use stdout and stderr here> ./ command.sh> / dev / null 2> & 1 
It’s not too late to change.

Guess you like

Origin www.cnblogs.com/jenkin1991/p/11606545.html