Secure backup script from deleting by accident
parent
1406fe6c03
commit
4e8d6b4279
|
@ -16,7 +16,6 @@ if [ -z "$1" ]
|
||||||
tar -xzf ${DATE}.tar.gz
|
tar -xzf ${DATE}.tar.gz
|
||||||
rm -rf ../api/resource
|
rm -rf ../api/resource
|
||||||
cp -Rv ${DATE}/resource ../api/
|
cp -Rv ${DATE}/resource ../api/
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for i in "${col[@]}"
|
for i in "${col[@]}"
|
||||||
|
@ -39,5 +38,8 @@ if [ -z "$1" ]
|
||||||
tar -zcf ${DATE}.tar.gz ${DATE}
|
tar -zcf ${DATE}.tar.gz ${DATE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf ${DATE}
|
# 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])$ ]]
|
||||||
|
then
|
||||||
|
rm -rf ${DATE}
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue