Fix backup script
parent
4e8d6b4279
commit
a83d5fe790
|
@ -29,17 +29,15 @@ do
|
|||
fi
|
||||
done
|
||||
|
||||
if [ $(ls -lt --hide=backup.sh | wc -l) -gt 6 ]; then
|
||||
if [ $(ls -lt --hide=backup.sh | wc -l) -gt 14 ]; then
|
||||
$(rm "$(ls -t --hide=backup.sh | tail -1)")
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
tar -zcf ${DATE}.tar.gz ${DATE}
|
||||
fi
|
||||
|
||||
# to avoid file deletion, if date to apply is entered with .tar.gz ending
|
||||
if [[ $1 =~ ^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$ ]]
|
||||
rm -rf ${DATE}
|
||||
elif [[ $1 =~ ^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$ ]]
|
||||
then
|
||||
rm -rf ${DATE}
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue