OS/Linux

1년 이상 된 로그 삭제해서 삭제목록 리스트 남기기

­행복 2017. 12. 7. 20:47

#Check Point

while read CheckPoint
do
rm -f -v $L_PATH/$CheckPoint/$(date -d -182days '+%Y-%m-%d')* 2>&1 | tee -a $D_PATH/del-`date +%F`.txt
rm -f -v $S_PATH/$CheckPoint/$(date -d -365days '+%Y-%m-%d')* 2>&1 | tee -a $D_PATH/del-`date +%F`.txt
done < $CPFWs

#PALO-ALTO

while read PaloAlto
do
find $L_PATH/$PaloAlto/ -mtime +365 -exec rm -fv {} \; 2>&1 | tee -a $D_PATH/del-`date +%F`.txt
done < $PAFWs


#secui

find $L_PATH/secuilog/ -mtime +180 -exec rm -fv {} \; 2>&1 | tee -a $D_PATH/del-`date +%F`.txt
find $S_PATH/secuilog/ -mtime +365 -exec rm -fv {} \; 2>&1 | tee -a $D_PATH/del-`date +%F`.txt
find $S_PATH/SDS-Mgmt/ -mtime +365 -exec rm -rfv {} \; 2>&1 | tee -a $D_PATH/del-`date +%F`.txt