nohup: ignoring input and appending output to ‘nohup.out’
Nohup: ignoring input and appending output to ‘nohup.out’
Currently, I"m making use of nohup command & to send it in history. Yet the issue is: if I perform nohup command & I obtain outout as:
origin ubuntu:/ home/test #I put on"t intend to push "GO INTO TRICK" after nohup rest 10 &.
As, I"m servicing automation component, I require that after one command is sent out to history, I need to have the ability to carry out following command without pushing any type of secret. Like:
origin ubuntu:/ home/test # nohup start-client. py &yet the issue is, after start-server. py obtains implemented, it won"t carry out following command. I require to push "GO INTO SECRET" to go with following command.Is there any type of
option? Any type of aid would certainly be substantially valued.
nohup rest 10 2 >/ dev/null & The nohup command publishes a message to stderr, as well as 2 >/ dev/null sends out stderr to/ dev/null. No demand for get in. Simply kind your following command and also it will certainly function(what you see is simply some result after your covering motivate has actually been result)
. This is precisely the like what occurs when you kind go into at the covering timely: you obtain one more prompt.:--RRB- You wear"t truly require to push Get in. Although it resembles the basic mistake from nohup gets on your command line, you can"kind over" it, and also just what you kind is gotten in as the following command.
From https://stackoverflow.com/a/10408906/738947!.?.!nohup just contacts nohup.out if the result is or else
to the incurable. If you reroute the result of the command elsewhere-consisting of/ dev/null -that"s where it goes rather. nohup command >/ dev/null 2 > & 1 # doesn "t develop nohup.outIf you"re utilizing nohup, that possibly indicates you intend to run the command behind-the-scenes by placing an additional & on completion of the entire point: nohup command >/ dev/null 2 > & 1 & # runs in history, still doesn"t develop nohup.outOn Linux, running a task with nohup instantly shuts its input too. On various other systems, especially BSD as well as OS X, that is not the instance, so when running in the history, you may intend to shut its input by hand. While shutting input has no result on the development or otherwise of nohup.out, it stays clear of one more issue: if a history procedure attempts to review anything from basic input, it will certainly stop briefly, waiting on you to bring it back to the foreground and also kind something. So the extra-safe variation resembles this: nohup command/ dev/null 2 > & 1 & # entirely removed from incurable Note, nevertheless, that this does not protect against the command from accessing the incurable straight, neither does it eliminate it from your covering "s procedure team. If you wish to do the last, you can do so by running disown without disagreement as the following command, whereupon the procedure is no more related to a covering" work"and also will certainly not have any type of signals(not simply HUP)sent to it from the shell.Explanation: In Unixy systems, every resource of input or target of outcome has actually a number related to it called a"data descriptor", or"fd "for brief. Every running program("procedure" )has its very own collection of these, as well as when a brand-new procedure launches it has 3 of them currently open:"basic input ", which is fd 0, is open for the procedure to check out from, while"conventional result "(fd 1)as well as"common mistake "( fd 2)are open for it to contact. If you simply run a command in an incurable home window, then by default, anything you kind mosts likely to its typical input, while both its common result and also basic mistake obtain sent out to that window.But you can ask the covering to transform where any type of or every one of those documents descriptors factor prior to introducing the command; that "s what the redirection(,, >, >> )as well as pipeline( |)drivers do.The pipeline is the most basic of these ... command1|command2 schedules the basic result of command1 to feed straight right into the conventional input of
command2. This is a really helpful plan that has actually brought about a specific layout pattern in UNIX devices( and also discusses the presence of common mistake, which permits a program to send out messages to the individual despite the fact that its result is entering into the following program in the pipe). Yet you can just pipeline conventional outcome to typical input; you can "t send out any kind of various other documents descriptors to a pipeline without some juggling.The redirection drivers are friendlier because they allow you define which documents descriptor to reroute. So 0 reviews typical input from the data called infile, while 2 >> logfile adds typical mistake throughout of the data called logfile. If you wear" t define a number, then input redirection defaults to fd 0(coincides as 0), while outcome redirection defaults to fd 1(> coincides as 1 >). Likewise, you can integrate documents descriptors with each other: 2 > & 1 implies" send out common mistake anywhere basic result is going". That implies that you obtain a solitary stream of
result that consists of both typical out as well as typical mistake intermixed without any means to divide them any longer, yet it likewise suggests that you can consist of conventional mistake in a pipeline. So the series >/ dev/null 2 > & 1 implies "send out basic outcome to/ dev/null "(which is an unique tool that simply gets rid of whatever you contact it)" and afterwards send out common mistake
to any place typical outcome is going "(which we simply ensured was/ dev/null). Essentially, "get rid of whatever this command contacts either data descriptor ". When nohup identifies that neither its typical mistake neither outcome is connected to an incurable, it doesn"t trouble to produce nohup.out, yet presumes that the outcome is currently rerouted where the individual desires
it to go.The/ dev/null tool helps input, also; if you run a command with, then any kind of effort by that command to check out from typical input will promptly come across end-of-file. Keep in mind that the combine phrase structure won"t have the exact same result right here; it just functions to direct a data descriptor to an additional one that "s open parallel (input or result). The covering will certainly allow you do >/ dev/null, however that end up developing a procedure with an input data descriptor open on an outcome stream, so rather than simply striking end-of-file, any type of read effort will certainly activate a deadly"void documents descriptor"mistake.