How to flush output to disk?

Dan Bernstein brnstnd at stealth.acf.nyu.edu
Thu Dec 7 08:10:38 AEST 1989


In article <606 at caldwr.UUCP> rfinch at caldwr.UUCP (Ralph Finch) writes:
> Is there any way to force the output to be flushed more often, say every
> 15-30 minutes?

It sounds like you want stdio output flushed, as in the fflush() call.
If changing the source to use fflush() is impossible, stick the program
under a pty (using, for example, my pty program) so that stdio writes
each line as soon as it sees the newline.

In article <1025 at friar-taac.UUCP> matthew at friar-taac.UUCP (Matthew Stier - Sun Visualization Products) writes:
> The following, untested, script should do it. 
> (I know using 'sync' is a little heavy 
> handed, but it gets the job done.)

sync makes sure that the data in the buffers is (at least scheduled to
be) written to disk; this doesn't affect any normal operations other
than straight reads from the raw disk device. In particular, it
certainly doesn't affect stdio.

---Dan



More information about the Comp.unix.questions mailing list