Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write to a file with a max file size

Status
Not open for further replies.

vodkadrinker

Technical User
May 16, 2002
163
0
0
GB
What I want to do is write the output of a truss to a file, however I only want to keep the last say 200 lines.

Is there a way I can do this without creating a large output file first?
 
lol sjm2 tail won't work on a truss, already tried it, I think there is a way to do this by creating a special device but I can't remember how.
 
# oslevel
5.3.0.0
# truss date 2>&1 | wc -l
67
# truss date 2>&1 | tail -10
getgidx(1) = 0
__loadx(0x01480080, 0x2FF21940, 0x00000960, 0x2FF223C0, 0x00000000) = 0xD014B130
access("/usr/lib/nls/msg/en_GB/date.cat", 0) = -1
access("/usr/lib/nls/msg/en_US/date.cat", 0) = 0
_getpid() = 286962
kioctl(1, 22528, 0x00000000, 0x00000000) = -1
Wed 8 Jun 15:31:21 2011
kwrite(1, " W e d 8 J u n 1".., 25) = 25
kfcntl(2, F_GETFL, 0xF02A19B8) = 1
_exit(0)
#
 
In this instance the process could be running in the background for many hours and it's not a process I can start, I was trying to capture the point were the process was falling over. I have done this by running it to a screen.

I did try the truss but in this senario it didn't work, I was trying to aviod running to a screen incase the session dropped and I also didn't want the overhead of writing a large output file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top