Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removal of the nohup -file during the execution

Tags:

nohup

I did the following:

nohup find / &

rm nohup.out

Oddly, the nohup -command continued to run. I awaited for a new file to be created. For my surprise there was no such file. Where did the stdout of the command go?

like image 335
Léo Léopold Hertz 준영 Avatar asked Apr 28 '09 06:04

Léo Léopold Hertz 준영


People also ask

How do I get rid of nohup?

Ending the nohup command with an & makes the command run in the background, even after you exit the shell. To exit the shell in this situation, enter the exit command. nohup ensures that the command does not end when the creating process ends.

Where is nohup out saved?

Since there isn't a terminal to associate with it, nohup logs everything to an output file, nohup. out . By default, that file is located in whichever directory you started the command in. nohup.

What does nohup out do?

nohup is a POSIX command which means "no hang up". Its purpose is to execute a command such that it ignores the HUP (hangup) signal and therefore does not stop when the user logs out. Output that would normally go to the terminal goes to a file called nohup. out, if it has not already been redirected.

How does nohup check background process?

Run ping command with nohup command. Re-open the terminal and run pgrep command again. You will get the list of the process with process id which is running. You can stop any background process by running kill command.


2 Answers

if you will delete the nohup.out file, the handle will be lost and it will write only to the file descriptor but if you want to clean out the nohup.out file then just run this

true > nohup.out

it will delete the contents of the file but not the file.

like image 126
Saad Saadi Avatar answered Oct 04 '22 20:10

Saad Saadi


cat /dev/null > nohup.out

from here

like image 21
buxizhizhoum Avatar answered Oct 04 '22 20:10

buxizhizhoum