create tar from backup folders
parent
7e970940ae
commit
c22256f2aa
|
@ -21,14 +21,19 @@ do
|
|||
# provide date for restore process, if data import is needed
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
mongoexport --db cc --collection $i --out $(date '+%Y-%m-%d')/collections/${i}.json;
|
||||
cp -R ../api/resource $(date '+%Y-%m-%d')/
|
||||
DATE=$(date '+%Y-%m-%d')
|
||||
mongoexport --db cc --collection $i --out ${DATE}/collections/${i}.json;
|
||||
cp -R ../api/resource ${DATE}/
|
||||
tar -zcf ${DATE}.tar.gz ${DATE}
|
||||
rm -R ${DATE}
|
||||
if [ $(ls -l | grep -c ^d) -gt 5 ]; then
|
||||
deleteOldest
|
||||
fi
|
||||
else
|
||||
tar -xzf ${1}.tar.gz
|
||||
mongoimport --db cc --collection $i --drop --file ${1}/collections/${i}.json
|
||||
rm -rf ../api/resource
|
||||
cp -Rv ${1}/resource ../api/
|
||||
rm -R ${1}
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue