update
This commit is contained in:
18
roles/05-update/templates/version-switch.sh.j2
Normal file
18
roles/05-update/templates/version-switch.sh.j2
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
OLD_VERSION="$1"
|
||||
NEW_VERSION="$2"
|
||||
SERVER_DIR="{{ minecraft_server_dir }}"
|
||||
BACKUP_DIR="{{ minecraft_backups_dir }}/version_backup"
|
||||
|
||||
# Create backup directory
|
||||
mkdir -p "${BACKUP_DIR}"
|
||||
|
||||
# Backup current version
|
||||
mv "${SERVER_DIR}" "${BACKUP_DIR}/server_${OLD_VERSION}_$(date +%Y%m%d_%H%M%S)"
|
||||
|
||||
# Switch to new version
|
||||
mv "${SERVER_DIR}_${NEW_VERSION}" "${SERVER_DIR}"
|
||||
|
||||
echo "Version switched from ${OLD_VERSION} to ${NEW_VERSION}"
|
||||
exit 0
|
Reference in New Issue
Block a user