Nohup redirect output to a file without -o parameter

Emir Buğra KÖKSALAN tarafından tarihinde yayınlandı

Nohup is nice tool for runing an app in background. It can redirect output to a file with “-o” parameter. But this parameter has to write to last. For example

nohup myapp -o nohup.log

This prints all outputs to nohup.log file. But there is a problem. Some commands accepts it parameter. That means:

myapp -o nohup.log

“-o nohup.log” parameter doesnt passed to “nohup” command. For prevent this problem you must redirect output yourself. In linux there are two kind of outputs. Standard output and error output. You must redirect these to one file. The code is that:

nohup myapp -param1 -param2 -param3 > nohup.out 2> nohup.out &

“>” means “redirect standard output to that”, “2>” means “redirect error output to that”.“&” character means “run in background although I logout from shell”.

Kategoriler: EnglishLinux

Emir Buğra KÖKSALAN

Java & PHP Developer

0 yorum

Bir yanıt yazın

Avatar yer tutucu

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Time limit is exhausted. Please reload the CAPTCHA.

Bu site, istenmeyenleri azaltmak için Akismet kullanıyor. Yorum verilerinizin nasıl işlendiği hakkında daha fazla bilgi edinin.