행위

아카이브 로그 삭제 스크립트

DB CAFE

thumb_up 추천메뉴 바로가기


#!/bin/bash

# 1.아카이브 디렉토리 위치 
export ARCH_DIR="/kkckc/archDir" 

# 1.아카이브 파일 확장자명 
export FILE_EXT="arc"
count=0

while :
do
FILES=$(ls -lrt $ARCH_DIR/*.$FILE_EXT | awk {'print $9'})
count=0
tcount=0

for file in $FILES; do
        let "count+=1"
done

for file in $FILES; do
                let "tcount+=1"
            if [ "$tcount" -ne "$count" ]
                        then
                                echo "DELETE $file"
                                rm -rf $file
                fi
done
sleep 10
done
#echo "COUNT:$count"