From b3179cba7fe0c5e1de2c5e4dc12e355b9d4433dc Mon Sep 17 00:00:00 2001 From: mathias Date: Thu, 5 Jul 2018 23:51:43 +0300 Subject: [PATCH] Add world reset system based on world size --- bin/start | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/start b/bin/start index 44035c4..3649843 100755 --- a/bin/start +++ b/bin/start @@ -4,7 +4,12 @@ touch banned-ips.json banned-players.json ops.json usercache.json whitelist.json echo "$PRIVATE_KEY" > .ssh/id_rsa chmod 400 $(find . ! -path "*/.*" ! -path "./worlds/world/region/*" -type f) chmod -R 500 crash-reports/ dumps/ plugins/bStats/ plugins/PluginMetrics/ plugins/ProtocolLib/ plugins/Updater/ -rsync -Waqz -e "ssh -o StrictHostKeyChecking=no -T -c aes256-ctr -o Compression=no -x" --exclude-from="bin/excludes" serv@kaboom.pw:sync/ . + +if [ "$(ssh -o StrictHostKeyChecking=no -T -c aes256-ctr -o Compression=no -x serv@kaboom.pw 'du -s sync/' | awk '{print $1}')" -gt "500000" ]; then + ssh -o StrictHostKeyChecking=no serv@kaboom.pw 'rm -rf sync/' +else + rsync -Waqz -e "ssh -o StrictHostKeyChecking=no -T -c aes256-ctr -o Compression=no -x" --exclude-from="bin/excludes" serv@kaboom.pw:sync/ . +fi while true; do rsync -Waq -e "ssh -o StrictHostKeyChecking=no -T -c aes256-ctr -o Compression=no -x" --exclude-from="bin/excludes" plugins worlds serv@kaboom.pw:sync/ > /dev/null 2>&1