✅ 특정 파일 삭제 스크립트
#!/bin/sh
YMD_BASIC=`date +%Y%m%d`
YMD_HMS_BASIC=`date +%Y%m%d_%H%M%S`
{
echo file delete start $YMD_HMS_BASIC
#sed -i 's/^M//g' /backup/pds/deletefile/destoryfile_202007221717.txt
INPUTFILE=/backup/pds/deletefile/destoryfile_202007221717.txt
while read line
do
echo /backup$line rm -rf /backup$line
done < "$INPUTFILE"
YMD_BASIC_END=`date +%Y%m%d_%H%M%S`
echo file delete end $YMD_BASIC_END
} > /backup/pds/deletefile/deletefile$YMD_BASIC.log
✅ 첨부파일 압축 스크립트
#!/bin/sh
#압축할 폴더 리스트
DIRS=`find \`ls\` -type d`
#압축할 폴더 총건수
DIRSCNT=`find \`ls\` -type d | wc -l`
#압축대상조절건수
cnt=1
#파일명순번
FNM=1
#압축할 폴더 총건수 담을 변수
TotalCnt=$DIRSCNT
#현재일시
YMD_HMS_BASIC=`date +%Y%m%d_%H%M%S`
echo "첨부파일 압축 START : "$YMD_HMS_BASIC
echo "총건수 : "$TotalCnt
DIR_ARR=""
for DIR in $DIRS
do
DIR_ARR=$DIR_ARR" "$DIR
if [ $cnt -gt 44 ]; then
echo "폴뎌명:"$DIR_ARR
tar -zcvf "attach"$FNM.tgz $DIR_ARR
DIR_ARR=""
cnt=0
FNM=$(($FNM + 1))
else
if [ $cnt -eq 1 ]; then
echo "****** 쓰레드 : "$FNM" 건******"
fi
fi
cnt=$(($cnt + 1))
done
echo "첨부파일 압축 END : "$YMD_HMS_BASIC
'리눅스' 카테고리의 다른 글
리눅스 ant 설정( maverick-ant.jar 추가 ) (0) | 2022.09.22 |
---|---|
AWK 사용법 (0) | 2022.08.24 |
yum 동작원리 및 명령어 (0) | 2022.05.17 |
ssh 터널링 자동 실행 (0) | 2022.01.21 |
proxy server 구축 (0) | 2021.12.07 |