diff --git a/utils/README.md b/utils/README.md index 0f1752bc..9b263c59 100644 --- a/utils/README.md +++ b/utils/README.md @@ -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 diff --git a/utils/backupSync.sh b/utils/backupSync.sh new file mode 100644 index 00000000..61099895 --- /dev/null +++ b/utils/backupSync.sh @@ -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}/*/*