Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable writing to nohup.out

I am running a java application using the nohup command.

nohup java -jar test.jar

I am using log4j to write output from my application. In the log4j.properties file, I have a file this writes the output. The problem is that I have the same output twice in nohup.out and in test.log(I have configured this in the log4j.properties file)

Is there a way of disabling the writing of the output to nohup.out?

like image 394
vikifor Avatar asked Nov 29 '15 15:11

vikifor


People also ask

How do I use the nohup command without getting nohup out?

The nohup command only writes to nohup. out if the output would otherwise go to the terminal. If you have redirected the output of the command somewhere else - including /dev/null - that's where it goes instead.

How do I stop a nohup script?

When using nohup and you put the task in the background, the background operator ( & ) will give you the PID at the command prompt. If your plan is to manually manage the process, you can save that PID and use it later to kill the process if needed, via kill PID or kill -9 PID (if you need to force kill).

Is it safe to delete nohup out?

You can delete it if you don't want what's in it, but if the program that created the file is still running, then the disk space won't actually be reclaimed until the program exits.

What is nohup output?

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. nohup.


1 Answers

You can redirect nohup output to /dev/null.

nohup java -jar test.jar >/dev/null
like image 156
Vivek Goel Avatar answered Sep 30 '22 18:09

Vivek Goel