add backup sync script

This commit is contained in:
HF 2020-04-27 04:59:58 +02:00
parent 43d914ed3c
commit cd7c373277
2 changed files with 20 additions and 0 deletions

View File

@ -34,3 +34,6 @@ Converts a proxy list in specific txt format to a better readable list
## imageClean.py
python3 script that takes an input image and cleares spare pixels and bot remains
## backupSync.sh
shell script that can be launched with backup.js to sync to a storage server after every backup. It uses rsync which is much faster than ftp, sftp or any other methode

17
utils/backupSync.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/sh
TMPDIR="/tmp/backup"
#delete older daily backup folders from local filesystem if exist
cd ${TMPDIR}
if [ "`ls -t | wc -l`" -gt "1" ]
then
ls -t | tail -n +2 | xargs rm -rf --
fi
cd - > /dev/null
rsync -r ${TMPDIR}/ backup@ayylmao:/backup/pixelplanet/canvas
#clear current daily folder
#we do NOT delete the daily folder itself, because the backup script would create
#a new full backup if its missing
rm -rf ${TMPDIR}/*/*