Other Help Topics :: Grabbing output
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.
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
Thanks that works.
It seems stderr is not put into the log files. Can this be fixed?
Yes:
myprogramname 2>&1 | split -b 10m - /home/damnsmall/logfile. &
Next Page...
original here.