BackupManager
Provides access to the server’s Back-up Manager for creating, restoring, deleting, and configuring back-ups. The backup global exposes the existing ServerObject.backup instance.
View the source: BackupManager
Methods
Section titled “Methods”backup.save()
Section titled “backup.save()”Immediately saves the state of the server to a back-up file. Returns {'name': str, 'size': str, 'date': str}, or None when failed
backup.restore(backup_obj)
Section titled “backup.restore(backup_obj)”Restores a back-up from a BackupObject. Use the backup.latest or backup.list attribute to retrieve a BackupObject
| Parameters | Type | Description |
|---|---|---|
backup_obj* | BackupObject | Retrieve from backup.latest or backup.list |
backup.set_directory(new_directory)
Section titled “backup.set_directory(new_directory)”Migrates all the back-up files from the previous directory to the specified new_directory
| Parameters | Type | Description |
|---|---|---|
new_directory* | str | A folder on the filesystem, and will create it if it doesn’t exist |
backup.set_amount(amount)
Section titled “backup.set_amount(amount)”Configures the maximum amount of back-ups that can be saved to backup.directory before overwriting
| Parameters | Type | Description |
|---|---|---|
amount* | int / str | Maximum number of back-ups to retain ('unlimited' to disable the limit) |
backup.enable_auto_backup(enabled=True)
Section titled “backup.enable_auto_backup(enabled=True)”Enables or disables automatic server back-ups.
| Parameters | Type | Description |
|---|---|---|
enabled | bool | Enable automatic back-ups. Defaults to True. |
backup.delete(backup_obj)
Section titled “backup.delete(backup_obj)”Deletes the specified BackupObject if it belongs to this server’s back-up list and no back-up operation is active. Returns True if removed, otherwise False.
| Parameters | Type | Description |
|---|---|---|
backup_obj* | BackupObject | From backup.latest or backup.list |
backup.return_backup_list(fetch_metadata=True)
Section titled “backup.return_backup_list(fetch_metadata=True)”Returns a list of the current BackupObject values. With metadata fetching enabled, each object also loads version and modpack metadata stored inside the archive
| Parameters | Type | Description |
|---|---|---|
fetch_metadata | bool | Load internal metadata for each back-up when True (default) |
backup.is_backing_up()
Section titled “backup.is_backing_up()”Returns True while a save operation is in progress for this server
backup.set_log_limit(limit)
Section titled “backup.set_log_limit(limit)”Sets the maximum amount of log data retained with server back-ups
| Parameters | Type | Description |
|---|---|---|
limit* | int / str | Maximum retained back-up log size in MB, or 'unlimited' to disable the limit |
Attributes
Section titled “Attributes”| Attribute | Type | Description |
|---|---|---|
backup.directory | str | Default filesystem directory to save and restore back-ups from |
backup.maximum | int / 'unlimited' | Shows the maximum amount of back-ups allowed in backup.directory |
backup.auto_backup | bool | Shows whether automatic server back-ups are enabled or not |
backup.log_limit | int / 'unlimited' | Maximum retained log size in each back-up (MB) |
backup.total_size | int | Contains storage utilization in bytes of all back-ups in backup.directory |
backup.latest | BackupObject / None | Metadata for the newest back-up; exposes BackupObject.path, BackupObject.size, BackupObject.date, and loaded version/modpack metadata |
backup.list | list: BackupObject | File details of all back-ups sorted from most recent in descending order at backup.list[0]. Exposes BackupObject.path, BackupObject.size, BackupObject.date, and loaded version/modpack metadata |