Files
ql-lg-server/scripts/backup.sh
T

17 lines
715 B
Bash
Executable File

#!/bin/sh
# Nightly backup of settings, secrets, admins/bans and plugins (not the game files: setup.sh
# re-downloads them). backups/ql-YYYY-MM-DD.tar.gz, 14 days kept. Also empties QL's log files
# once they pass 50 MB (QL appends to them forever).
. "$(dirname "$0")/env.sh"
set -e
umask 077
mkdir -p backups
chmod 700 backups
tar czf backups/ql-$(date +%F).tar.gz .env secrets home/baseq3/access.txt \
home/baseq3/server.cfg home/baseq3/scripts home/minqlx-plugins home/baseq3/botfiles home/lgbot.json 2>/dev/null || true
find backups -name "ql-*.tar.gz" -mtime +14 -delete
for f in home/baseq3/*.log home/minqlx.log; do
if [ -f "$f" ] && [ "$(stat -c %s "$f")" -gt 52428800 ]; then : > "$f"; fi
done
exit 0