One-command setup (SteamCMD + pinned, checksum-verified ReHLDS / ReGameDLL / Metamod-R / AMXX / ReAPI / ReUnion / CSDM-ReAPI / YaPB / GunGame), .env settings, ./cs menu (map, DM/GunGame mode, bots, kill counter, restart, update), own plugins (extras, rtv, mode switch), all-time kill counter, watchdog + nightly backup, docs for admins and players. Co-Authored-By: Claude Opus 5.5 <[email protected]>
25 lines
1016 B
Bash
Executable File
25 lines
1016 B
Bash
Executable File
#!/bin/sh
|
|
# Nightly backup (cron 04:30, see install-cron.sh): settings, secrets, configs, stats and the
|
|
# kill tally into backups/cs16-YYYY-MM-DD.tar.gz, kept 14 days. Game files are not included
|
|
# (./setup.sh downloads them again). Also saves the kill tally and prunes logs older than 30 days.
|
|
. "$(dirname "$0")/env.sh"
|
|
set -e
|
|
cd "$D"
|
|
umask 077
|
|
mkdir -p backups
|
|
C=hlds/cstrike
|
|
# keep only paths that exist (a fresh install has no stats yet)
|
|
LIST=
|
|
for p in .env secrets kills-tally.json $C/mapcycle.txt $C/custom.cfg $C/reunion.cfg \
|
|
$C/addons/amxmodx/configs $C/addons/amxmodx/data $C/gungame.stats $C/gungame.streaks \
|
|
$C/addons/yapb/conf; do
|
|
[ -e "$p" ] && LIST="$LIST $p"
|
|
done
|
|
tar czf "backups/cs16-$(date +%F).tar.gz" $LIST
|
|
find backups -name "cs16-*.tar.gz" -mtime +14 -delete
|
|
|
|
# count the kills in the logs before old logs go away
|
|
python3 kills > /dev/null || true
|
|
find $C/logs $C/addons/amxmodx/logs -name "*.log" -mtime +30 -delete 2>/dev/null || true
|
|
echo "$(date '+%F %T') backup ok"
|