Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-02-2013, 01:40 AM   #1
Registered: Aug 2012
Posts: 95

Rep: Reputation: Disabled
nohup query

I have a JBOSS server process which i am running it using nohup command({nohup ./}), & same out put is getting printed to Jboss server.log as well,As i dont want the two log files having the same log entries then i tried the command nohup ./ > ../log/server.log

Using this format log entries in server.log are getting printed twice.

Is there a better way by which i can redirect all output of nohup command to server.log without writing the same details twice to Jboss server log

please please suggest
Old 01-02-2013, 09:15 AM   #2
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060
You're dealing with two output channels, stdout and stderr. The system automatically opens three channels for you, stdin (the keyboard, channel 0), stdout (the monitor, channel 1) and stderr (the monitor, channel 2). You can redirect channel 1 and channel 2; i.e., when you
prog > file
that puts standard output into file. When you do
prog 2> /dev/null
that puts standard error into /dev/null, the system black hole. By the same token, you can redirect standard error into one file and standard output into another file:
prog > file01 2> file02
Or (in you case you don't care about this) you can combine standard output and standard error into one
prog > file 2>&1
Now the above a valid for sh, ksh and BASH (the Bourne based shells) -- if you're using C-Shell, well, that last time I used that was about 30 years ago and I've forgotten how to do redirects with it (it's different), sorry.

If you just execute your program (without nohup) do you get double logs? If so, it might be a good idea to actually specify log files in the program -- open, write to, close -- to avoid duplication (or, maybe, tell JBoss to shut up, eh?). If that's not a problem, try the above and see what you get.

Hope this helps some.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Query about nohup abhisek.bhaumik Programming 5 08-02-2011 02:32 AM
interesting MySQL query/view query :s mjh Programming 3 03-25-2008 08:30 AM
nohup sycamorex Linux - General 4 01-08-2008 06:49 PM
problem with nohup command and nohup file size vbseeker Linux - General 1 09-17-2006 12:36 PM
help with mysql query: return nth rows in query hawarden Programming 2 07-31-2006 07:36 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:19 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration