zoukankan      html  css  js  c++  java
  • 清理cosbench工具所占用磁盘空间的小脚本

    经常跑cosbench的测试,发现cosbench运行一段时间之后,会把其所在的磁盘的空间快速的消耗。经过检查,以下的两个地方费空间比较多:

    1. Controller的archive目录中,每运行一次,当操作比较多,所生成的object比较多的时候,产生的workload.log文件会非常大。
    2. Driver的./log/misson/* 里的mission log会比较大。

    当测试正常结束,没有错误的时候,这些文件就会浪费比较多的空间,需要定期清理。于是,我就写了下面的小脚本,来清理掉这些文件。

    #!/bin/bash
    
    # Commands in this script will free space from both cosbench drivers and controller.
    # Clear the mission logs that are older than two days on these clients.
    clients=("10.245.109.216" "10.245.109.217" "10.245.109.218" "10.245.109.219" "10.245.109.220" "10.245.109.221" "10.245.109.222" "10.245.109.223")
    for i in ${!clients[@]};
    do
        ip=${clients[$i]}
        ssh $ip "find /opt/cosbench/0.4.2.c4/log/mission/M* -mtime +2 -exec rm {} ;"
    done
    
    # List all the workload.log files under archive directory then delete them.
    find /opt/cosbench/0.4.2.c4/archive -name 'workload.log' | xargs ls -alh
    find /opt/cosbench/0.4.2.c4/archive -name 'workload.log' | xargs rm


    供参考改造。


    写得比较匆忙,参考资料也丢掉了,在此向所有的慷慨大方的技术分享者们致敬!

  • 相关阅读:
    语言模型的压缩方法
    推荐算法之 Slope One 算法
    基于内容的推荐(Contentbased Recommendations)
    Txt文件转换为Excel文件
    WebResource 内嵌资源
    多层模态窗口showModalDialog页面提交及刷新
    屏蔽/自定义JavaScript脚本错误
    .net动态显示当前时间
    客户端自动累加
    中国IT管理之窥豹一斑
  • 原文地址:https://www.cnblogs.com/awpatp/p/13920062.html
Copyright © 2011-2022 走看看