完美日切,内存中的日志文件完全清空!!!找了很久才找到的日切版本,自己机器已验证,项目环境还未验证!!!
1、本人系统为CentOS Linux release 7.6.1810
[root@yarcl ~]# /etc/redhat-release
/etc/redhat-release:行1: 未预期的符号 `(' 附近有语法错误
/etc/redhat-release:行1: `CentOS Linux release 7.6.1810 (Core) '
[root@yarcl ~]#
PS:虽然显示权限不够,但是还是可以看出来是什么系统的
2、nohup命令
nohup java .....省略一万点内容.....
--spring.profiles.active=${profiles} --isJar=true >> ${logPath}/${ModuleName}.log 2>&1 &
PS:
1)注意 --isJar=true后面采用的 >> 符号
2)执行命令最后面是2>&1 & 最后的&表示是后台运行
3、定时任务调度
1 0 * * * sh /home/work/blog/blog-0.0.1/bin/split.sh > /home/work/blog/blog-0.0.1/logs/crontab-`date +"\%Y\%m\%d"`.log
4、split.sh脚本
#!/bin/bash
echo "start split log format!"