Grabbing outputForum: Other Help Topics Topic: Grabbing output started by: numknuf Posted by numknuf on May 12 2004,20:48
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. Posted by cbagger01 on May 12 2004,22:42
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 Posted by numknuf on May 13 2004,07:55
Thanks that works.
Posted by numknuf on May 13 2004,11:22
It seems stderr is not put into the log files. Can this be fixed?
Posted by cbagger01 on May 13 2004,16:19
Yes:myprogramname 2>&1 | split -b 10m - /home/damnsmall/logfile. & Posted by numknuf on May 13 2004,20:00
Thanks again.
|