linux下的日志压缩脚本:

#!/bin/bash

#第一步:先定义项目列表如下:
projects="project-a project-b project-c project-d" #第二步:循环项目列表:
for project in $projects
do
#第三步:切换到每一个的项目列表下的info_log目录下,查找以数字0-9结尾的日志文件
#将日志文件压缩并打包,然后删除压缩前的日志文件。
cd /opt/soft/$project/info_log
for i in `ls | grep [-]$`
do
tar -czf $i.tar.gz $i
rm -rf $i
done #第四步:切换到每一个的项目列表下的error_log目录下,查找以数字0-9结尾的日志文件
#将日志文件压缩并打包,然后删除压缩前的日志文件。
cd /opt/soft/$project/error_log
for i in `ls | grep [-]$`
do
tar -czf $i.tar.gz $i
rm -rf $i #第五步:循环结束
done done

linux下的日志压缩脚本的更多相关文章

  1. Linux下重要日志文件及查看方式

    http://os.51cto.com/art/201108/282184_all.htm   1.Linux下重要日志文件介绍 /var/log/boot.log 该文件记录了系统在引导过程中发生的 ...

  2. Linux下重要日志及查看方式

    1.Linux下重要日志文件介绍 /var/log/boot.log 该文件记录了系统在引导过程中发生的事件,就是Linux系统开机自检过程显示的信息,如图1所示: 图1 /var/log/boot. ...

  3. [转]Linux下的lds链接脚本详解

    转载自:http://linux.chinaunix.net/techdoc/beginner/2009/08/12/1129972.shtml     一. 概论 每一个链接过程都由链接脚本(lin ...

  4. Linux下的lds链接脚本简介

    转载:http://hubingforever.blog.163.com/blog/static/171040579201192472552886/   一. 概论 每一个链接过程都由链接脚本(lin ...

  5. 在Linux下如何用Shell脚本读写XML?现有一个config.xml(转)

    在Linux下如何用Shell脚本读写XML?现有一个config.xml <?xml version="1.0" encoding="UTF-8"?&g ...

  6. linux下syslog-ng日志集中管理服务部署记录

    syslog是Linux系统默认的日志守护进程,默认的syslog配置文件是/etc/syslog.conf文件.syslog守护进程是可配置的,它允许人们为每一种类型的系统信息精确地指定一个存放地点 ...

  7. Linux下rsyslog日志收集服务环境部署记录【转】

    rsyslog 可以理解为多线程增强版的syslog. 在syslog的基础上扩展了很多其他功能,如数据库支持(MySQL.PostgreSQL.Oracle等).日志内容筛选.定义日志格式模板等.目 ...

  8. linux下gzip的压缩/解压缩详解

    linux下gzip的压缩详解 Linux压缩保留源文件的方法: gzip –c filename > filename.gz Linux解压缩保留源文件的方法: gunzip –c filen ...

  9. Linux下的lds链接脚本详解【转】

    转自:http://www.cnblogs.com/li-hao/p/4107964.html 转载自:http://linux.chinaunix.net/techdoc/beginner/2009 ...

随机推荐

  1. JAVA 比较两张图片的相似度的代码

    原文:http://www.open-open.com/code/view/1448334323079 import java.awt.image.BufferedImage; import java ...

  2. [Angular] Write Compound Components with Angular’s ContentChild

    Allow the user to control the view of the toggle component. Break the toggle component up into multi ...

  3. leetcode ----Trie/stack专题

    一:Implement Trie (Prefix Tree) 题目: Implement a trie with insert, search, and startsWith methods. Not ...

  4. glTF格式初步了解

    glTF格式初步了解 近期看到Qt 3D的进展.偶然了解到了一种新的格式:glTF格式.这样的格式据说比现有的3D格式更加符合OpenGL应用的须要.这引起了我的好奇.于是我在Qt 3D的外部链接中找 ...

  5. Git撤销&amp;回滚操作

    开发过程中.你肯定会遇到这种场景: 场景一: 糟了.我刚把不想要的代码.commit到本地仓库中了.可是还没有做push操作! 场景二: 彻底完了.刚线上更新的代码出现故障了.须要还原这次提交的代码! ...

  6. Linux Chromium安装Adobe Flash Player

    首先,下载: install_flash_player_11_linux.i386.tar.gz 解压文件: tar -xvf install_flash_player_11_linux.i386.t ...

  7. Python安装Mysql驱动出错解决(最新出炉)

    Python中最连接Mysql常用的驱动是 mysql-python :mysql的C语言的驱动 mysql-connector:msql官方的驱动 pymysql:python语言的驱动 我这里安装 ...

  8. 2016/05/16 UEditor 文本编辑器 使用教程与使用方法

    第一:百度UEditor编辑器的官方下载地址 ueditor 官方地址:http://ueditor.baidu.com/website/index.html 开发文档地址:http://uedito ...

  9. hashable

    Glossary — Python 3.6.5 documentation https://docs.python.org/3/glossary.html?highlight=equal hashab ...

  10. ECharts 使用

    最近项目中要做图形报表,要求使用echarts实现,图形报表有很多中实现之前也接触过,但echarts还是头一次听说,正好可以趁这个机会好好学习一下它. 之前不知道就不知道啦,现在知道了就了不得了,一 ...