I'm using the script utility to record terminal sessions, and using logrotate (with copytruncate
, script ignores HUP and keeps writing to the rotated file otherwise) to periodically upload chunks of what's happened so far to another server. This works great for the the actual screen contents.
Today I'm trying to also capture timing information, which script emits to STDERR. So my new script config looks like
script -faqt session.record 2> session.timing
The problem is that when I use logrotate on the timing data (session.timing) the backfilled file begins with a large number of null bytes in the output, which causes scriptreplay to hork when it reads the reconstructed file back in.
Is there a known problem (and hopefully workaround) using logrotate with the copytruncate option on STDERR redirected into a file?