Skip to content

Latest commit

 

History

History
36 lines (31 loc) · 691 Bytes

README.md

File metadata and controls

36 lines (31 loc) · 691 Bytes

tee

简介

tee 在完成gnu tee 功能命令基础上,并增强tee命令。

install

env GOPATH=`pwd` go get -u github.com/guonaihong/tee/tee

命令行选项

Usage of tee:
  -A, --max-archive int
    	How many archive files are saved
  -a, --append
    	append to the given FILEs, do not overwrite
  -g, --gzip
    	compressed archived log files
  -s, --max-size string
    	current file maximum write size

提供对日志文件的自动归档和裁减

  • loop.sh 内容
while :;
do
    date
done
  • tee命令保证始终只有10个归档文件(.gz), 超过1M自动归档
bash loop.sh | tee -A 10 -ga my.log -s 1M