Files
apps/scripts/clean_data.sh
2019-01-27 07:28:31 +01:00

35 lines
730 B
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Antidater les données des blocks connus
date=`date +%Y%m%d0000`
touch -t $date $DATA_PATH/emptybot/*
for BLOCK in `grep -v LAST $DATA_PATH/block_list.txt | grep -v CACHE | awk '{print $2}'`
do
touch -t $date $DATA_PATH/*/$BLOCK.*
done
# Effacer ce qui trop vieux
if [ "$#" -eq "0" ]
then
if [ -d $DATA_PATH ]
then
find $DATA_PATH -mtime +1 -type f -name *.png -exec rm -f {} \;
find $DATA_PATH -mtime +1 -type f -name *.zip -exec rm -f {} \;
find $TMP_PATH -mtime +3 -type f -name *.flag -exec rm -f {} \;
fi
else
if [ "$1" -eq "FULL" ]
then
if [ -d $DATA_PATH ]
then
rm -f $DATA_PATH/*/*
fi
if [ -d $TMP_PATH ]
then
rm -f $TMP_PATH/*
fi
fi
fi