# mkdir -p /usr/local/
|
# ./configure --prefix=/usr/local/
|
# make
|
# make check
# make install
|
# cd /usr/local/sbin
# ./cronolog -V
cronolog version 1.6.2
|
# ./cronolog -h
usage: ./cronolog [OPTIONS] logfile-spec
-H NAME, --hardlink=NAME maintain a hard link from NAME to current log
-S NAME, --symlink=NAME maintain a symbolic link from NAME to current log
-P NAME, --prev-symlink=NAME maintain a symbolic link from NAME to previous log
-l NAME, --link=NAME same as -S/--symlink
-h, --help print this help, then exit
-p PERIOD, --period=PERIOD set the rotation period explicitly
-d DELAY, --delay=DELAY set the rotation period delay
-o, --once-only create single output log from template (not rotated)
-x FILE, --debug=FILE write debug messages to FILE
( or to standard error if FILE is "-")
-a, --american American date formats
-e, --european European date formats (default)
-s, --start-time=TIME starting time
-z TZ, --time-zone=TZ use TZ for timezone
-V, --version print version number, then exit
|
# export MANPATH=$MANPATH:/usr/local/cronolog/man
# man cronolog
... ...
|
- 设置日志格式定义
/usr/local/sbin/cronolog 为cronolog安装后的路径。
|
/data/logs/ 为日志分割时候日志保存位置。
|
access_log.%Y%m%d 为日志文件的名称格式,每天一个文件。
|
# nohup ./deploy.sh >> ./log/deploy.log &
|
# nohup ./deploy.sh | /usr/local/sbin/cronolog "./log/deploy.logdeploy_%Y%m%d.log" &
|