定时任务分割日志

作者:系统管理员    类别:MySQL     日期:2021-05-07 04:25:48    阅读:20次    消耗积分:0
#!/bin/bash
#Date:2019-08-30
#58 23 * * * sh /data/scripts/filebeat_log_cut.sh >> /data/logs/cronolog.log 2>&1
. /etc/init.d/functions
Log_Name="filebeat"
Log_Path="/data/filebeat/logs/"
Date=$(date +%Y%m%d)
#备份当日日志

date +"[%F %T] Start"
CMD="cp $Log_Path$Log_Name.log $Log_Path$Log_Name$Date.log"
echo "$CMD"
$CMD
if [ $? == 0 ];then
  action "$Log_Path$Log_Name$Date.log 备份成功!"
  #生成新日志
  > $Log_Path$Log_Name.log
else
  action "$Log_Path$Log_Name$Date.log 备份失败!" /bin/false
fi
date +"[%F %T] End"

你可能也喜欢————

图片加载中...

Linux安装部署SVN

更新时间:2021-04-06 12:45:11


图片加载中...

WordPress优化

更新时间:2021-05-12 23:26:03


图片加载中...

Windows安装Linux子系统

更新时间:2021-04-17 20:28:59


图片加载中...

修改ssh默认端口

更新时间:2021-04-13 18:27:59


图片加载中...

Linux回收站

更新时间:2021-04-10 23:43:48


图片加载中...

htpasswd命令

更新时间:2021-04-06 03:24:08


图片加载中...

Ubuntu安装google-chrome

更新时间:2021-05-10 07:04:04


图片加载中...

服务器压力测试

更新时间:2021-04-28 19:03:31


图片加载中...

WSL挂载移动硬盘或U盘

更新时间:2021-04-24 10:12:30


有0条评论——


暂无评论!


发表评论——

提示:登录后才能发表评论,并且享受积分哦!