memtee is a replacement for 'tee' in situations were no read-write mounted filesystem is available.
In such a case memtee buffers all output into memory and when it receives the TERM-signal, it writes that buffered data into a file.
This way one can have for example the output of fsck in the startup-scripts buffered and when a filesystem
is mounted rw, one can signal memtee the flush that fsck-output onto disk by sending it a TERM signal.
/sbin/fsck -A -a 2>&1 | /usr/bin/memtee -o /var/log/fsck-boot.log -m 0
Here the output of 'fsck' is buffered. After 'fsck' terminates, memtee forks itself into the background.
When the filesystems are available for rw access, this command will make memtee write the output of fsck
/bin/pkill -TERM memtee
0.3 '-z' did not work. fixed
0.2 added '-z' switch which makes memtee act like a buffer: it will buffer everything like before, but will flush and exit as soon as the pipe to memtee is closed (e.g. the process from which it is buffering exits)
0.1 Initial release