Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (2) </ [1] 2 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Grabbing output, from a running process< Next Oldest | Next Newest >
numknuf Offline





Group: Members
Posts: 23
Joined: May 2004
Posted: May 12 2004,20:48 QUOTE

I have a program that outputs logs to stdout. I would like to start this program at boot before login. But I want to be able to read the current logging information. I tried with cat /dev/pts/# but didn't work, only sent my input.

Is this the right way to do this or should I do something else?
I can't send to a file since the output can grow huge in a couple of days.
Back to top
Profile PM 
cbagger01 Offline





Group: Members
Posts: 4264
Joined: Oct. 2003
Posted: May 12 2004,22:42 QUOTE

try:

myprogramname  | split -b 10m - /home/damnsmall/logfile.  &


It will launch myprogramname in the background and pipe the output through the split command.

Then split will create a bunch of 10 megabyte sized log files like:

logfile.aa
logfile.ab
logfile.ac
...


You can then periodically delete older logfiles in order to conserve disk space (like logfile.aa) once the program is now writing to a new file like logfile.ab
Back to top
Profile PM 
numknuf Offline





Group: Members
Posts: 23
Joined: May 2004
Posted: May 13 2004,07:55 QUOTE

Thanks that works.
Back to top
Profile PM 
numknuf Offline





Group: Members
Posts: 23
Joined: May 2004
Posted: May 13 2004,11:22 QUOTE

It seems stderr is not put into the log files. Can this be fixed?
Back to top
Profile PM 
cbagger01 Offline





Group: Members
Posts: 4264
Joined: Oct. 2003
Posted: May 13 2004,16:19 QUOTE

Yes:

myprogramname  2>&1 | split -b 10m - /home/damnsmall/logfile. &
Back to top
Profile PM 
5 replies since May 12 2004,20:48 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (2) </ [1] 2 >/
reply to topic new topic new poll
Quick Reply: Grabbing output

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code