shell脚本来检查fille的准确性

时间:2018-05-29 20:03:08

标签: linux bash shell sh

我有脚本检查删除了多少桶的准确性。我想写一个脚本来帮助我,一旦上面的脚本停止运行,它必须再次检查文件,并且有任何左侧桶创建输入列表并在其余部分上运行第二个“rm -rf”然后重复直到它们全部消失为止。 请找到以下脚本:

#!/bin/bash

rm /tmp/buckets_to_remove/*

# Ensure that the /tmp/buckets_to_remove directory exists and if not then create it
if [ ! -d /tmp/buckets_to_remove ]
 then
  mkdir /tmp/buckets_to_remove
fi

please find the error below:
Removing bucket act/1473823073_1459448859_XXXXX
Removing bucket act/1453904759_1438082433_XXXXX
Removing bucket act/1477122647_1442503432_XXXXX
Removing bucket asa/1473740503_1472875269_XXXXX
Removing bucket asa/1473741465_1473740502_XXXXX
Removing bucket asa/1473740504_1473740502_XXXXX

1 个答案:

答案 0 :(得分:0)

这是你在找什么?

rm命令将每15秒连续运行一次。

#!/bin/bash
# Ensure that the /tmp/buckets_to_remove directory exists and if not then create it
if [ ! -d /tmp/buckets_to_remove ]
    then
    mkdir /tmp/buckets_to_remove
fi

while(true)
    do
        for rmbuckets in $( ( ls /tmp/buckets_to_remove/ ) )
        do
            rm "$rmbuckets"
        done
    sleep 15
    done