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