### Install Blake3 Python Library Source: https://github.com/tisunion/primebackup/blob/master/docs/quick_start.md Installs the 'blake3' Python library, which is required if you choose 'blake3' as the hashing method. This may require a Rust runtime. ```bash pip3 install blake3 ``` -------------------------------- ### Create Backup Command and Example Output (MCDR) Source: https://context7.com/tisunion/primebackup/llms.txt Demonstrates how to create a new backup using the Prime Backup MCDR command, with examples of basic creation and creation with a comment. Includes sample console output showing the backup process and completion details. ```bash # Basic backup creation !!pb make # Backup with comment !!pb make Important milestone before boss fight ``` ```text # Example console output: # [MCDR] [00:46:11] [PB@51f5-worker-heavy/INFO]: [PB] Creating backup, please wait # [Server] [00:46:11] [Server thread/INFO]: Automatic saving is now disabled # [Server] [00:46:11] [Server thread/INFO]: Saved the game # [MCDR] [00:46:12] [PB@51f5-worker-heavy/INFO]: Create backup #59 done, +10 blobs (size 11.82MiB / 16.75MiB) # [MCDR] [00:46:12] [PB@51f5-worker-heavy/INFO]: [PB] Backup completed, ID #59, time cost 1.6s, total 118.39MiB (+16.75MiB) ``` -------------------------------- ### PrimeBackup Fixer Script Output Example Source: https://github.com/tisunion/primebackup/blob/master/tools/README.md An example of the output generated by the `issue_64_fixer.py` script, illustrating the steps of fileset validation, database recovery, and blob restoration. Comments within the output explain each stage of the process. ```bash # This '/path/to/pb_files' should be the Prime Backup instance you want to fix, value from --pb-dir [2025-03-30 01:49:05,402 INFO] (__init_pb_environment) Storage root set to '/path/to/pb_files' # First, the script will perform a fileset validation to figure out those corrupt filesets [2025-03-30 01:49:05,423 INFO] (__get_bad_base_fileset_ids) Locating bad fileset ids [2025-03-30 01:49:05,423 INFO] (run) Fileset validation start [2025-03-30 01:49:05,424 INFO] (run) Validating 492 fileset objects [2025-03-30 01:49:05,426 INFO] (run) Validating 200 / 492 fileset objects [2025-03-30 01:49:06,747 INFO] (run) Validating 400 / 492 fileset objects [2025-03-30 01:49:07,953 INFO] (run) Validating 492 / 492 fileset objects [2025-03-30 01:49:08,228 INFO] (run) Fileset validation done: total 492, validated 492, ok 434, bad 58 # Here's the file validation result # We only need to fix the base filesets [2025-03-30 01:49:08,228 INFO] (__get_bad_base_fileset_ids) Found 58 bad filesets [2025-03-30 01:49:08,228 INFO] (__get_bad_base_fileset_ids) Found 2 bad base filesets [2025-03-30 01:49:08,228 INFO] (__get_bad_base_fileset_ids) 399, 451 # Then, the script will try its best to recover file objects for these bad filesets, from all database files inside --db-backup-dir [2025-03-30 01:49:08,279 INFO] (__read_backup_db) Read 11075 file rows for fileset 399 from database '/path/to/db_backups/prime_backup_20250317.db' [2025-03-30 01:49:08,320 INFO] (__read_backup_db) Read 11217 file rows for fileset 451 from database '/path/to/db_backups/prime_backup_20250317.db' [2025-03-30 01:49:08,324 INFO] (__read_backup_db) Read 265 file rows for fileset 399 from database '/path/to/db_backups/prime_backup_20250324.db' [2025-03-30 01:49:08,364 INFO] (__read_backup_db) Read 11217 file rows for fileset 451 from database '/path/to/db_backups/prime_backup_20250324.db' [2025-03-30 01:49:08,367 INFO] (run) Recovering files for base fileset 399 [2025-03-30 01:49:08,583 INFO] (run) Recovering 10810 files for fileset 399 [2025-03-30 01:49:08,584 INFO] (run) Recovering files for base fileset 451 [2025-03-30 01:49:09,510 INFO] (run) Recovering 11154 files for fileset 451 [2025-03-30 01:49:09,861 INFO] (run) Recovered 21964 files in total # File object recover done. Perform another validation to double check the state [2025-03-30 01:49:09,861 INFO] (run) Perform another filesets validation since new files were added [2025-03-30 01:49:09,861 INFO] (run) Fileset validation start [2025-03-30 01:49:09,862 INFO] (run) Validating 492 fileset objects [2025-03-30 01:49:09,862 INFO] (run) Validating 200 / 492 fileset objects [2025-03-30 01:49:11,215 INFO] (run) Validating 400 / 492 fileset objects [2025-03-30 01:49:12,408 INFO] (run) Validating 492 / 492 fileset objects [2025-03-30 01:49:13,079 INFO] (run) Fileset validation done: total 492, validated 492, ok 492, bad 0 [2025-03-30 01:49:13,080 INFO] (run) NICE, fileset fix done # Rebuild those missing blob object in the database [2025-03-30 01:49:13,269 INFO] (run) Iterating all file objects in the database to check if there is any missing blob object [2025-03-30 01:49:13,949 INFO] (run) Recovered 2997 database blob objects in total # Now it's the time to recover those deleted blob files in the blob store # if --blobs-backup-dir is not provided, this step will be skipped [2025-03-30 01:49:14,125 INFO] (__find_blob_store_roots) Searching at 'blobs_backups' for blob storage roots, for hash_method blake3 with hex length 64 [2025-03-30 01:49:14,125 INFO] (__find_blob_store_roots) Found blob store root at '/path/to/blobs_backups/blobs_20250324' [2025-03-30 01:49:14,125 INFO] (__find_blob_store_roots) Found 1 blob store roots in total [2025-03-30 01:49:14,126 INFO] (run) Iterating all blobs in database to check if there is any missing blobs [2025-03-30 01:49:14,644 INFO] (run) Found 2997 blobs with their file missing, and recovered 2997 blob files in total ``` -------------------------------- ### Server Startup Command Source: https://github.com/tisunion/primebackup/blob/master/docs/feature/backup_restore.md The command used to start the Minecraft server with Prime Backup, specifying initial memory allocation. This command is part of the server's initialization process. ```bash java -Xms1G -Xmx2G -jar server.jar ``` -------------------------------- ### Prime Backup Overview Command Example Source: https://github.com/tisunion/primebackup/blob/master/docs/cli.md This snippet shows an example of how to use the Prime Backup CLI tool to display an overview of the database. It specifies a custom database path using the '-d' flag. ```bash $ python3 PrimeBackup.pyz -d run/pb_files overview [2023-12-09 20:31:39,929 INFO] Storage root set to 'run/pb_files' [2023-12-09 20:31:39,948 INFO] DB version: 1 [2023-12-09 20:31:39,948 INFO] Hash method: xxh128 [2023-12-09 20:31:39,948 INFO] Backup count: 2 [2023-12-09 20:31:39,948 INFO] Blob count: 9108 [2023-12-09 20:31:39,948 INFO] Blob stored size sum: 5158485126 (4.80GiB) [2023-12-09 20:31:39,949 INFO] Blob raw size sum: 8295323157 (7.73GiB) [2023-12-09 20:31:39,949 INFO] File count: 22010 [2023-12-09 20:31:39,949 INFO] File raw size sum: 16610326638 (15.47GiB) ``` -------------------------------- ### Install MCDR and Prime Backup Plugin (Bash) Source: https://context7.com/tisunion/primebackup/llms.txt Installs or updates MCDReforged, Prime Backup requirements, and optional dependencies for blake3 and lz4 support. It also details how to download and load the PrimeBackup.pyz plugin. ```bash # Install or update MCDReforged pip3 install mcdreforged>=2.12 -U # Install Prime Backup requirements pip3 install -r https://tisunion.github.io/PrimeBackup/requirements.txt # Optional: Install additional requirements for blake3 and lz4 support pip3 install blake3 lz4 # Download PrimeBackup.pyz from GitHub Releases and place in MCDR plugins folder # Then reload the plugin !!MCDR plugin reload prime_backup ``` -------------------------------- ### Restore Command Examples Source: https://github.com/tisunion/primebackup/blob/master/docs/feature/backup_restore.md Examples demonstrating the usage of the Prime Backup restore command with different backup ID formats and optional parameters. The command allows restoring to specific backups, the latest backup, or relative backups, and can be modified with flags like --confirm and --fail-soft. ```plaintext !!pb back 12 !!pb back ~ !!pb back ~1 !!pb back ~3 !!pb back 12 --confirm --fail-soft ``` -------------------------------- ### Target Files/Directories for Backup (JSON Example) Source: https://github.com/tisunion/primebackup/blob/master/docs/config.md Demonstrates how to specify target files and directories for backup using gitignore-style patterns. This allows flexible selection of data to be included in backups, such as specific world folders or patterns matching multiple directories. ```json "targets": [ "world", "world_nether", "world_the_end" ] ``` ```json "targets": [ "world*" ] ``` -------------------------------- ### Prune Log Example Source: https://github.com/tisunion/primebackup/blob/master/docs/config.md This is an example log file showing the results of a prune operation. Each line indicates a backup, its timestamp, whether it was kept ('keep=True') or deleted ('keep=False'), and the reason for the decision (e.g., 'keep last 1', 'superseded by 145 (hour)'). This log helps in understanding the prune logic and troubleshooting. ```log Backup #147 at 2023-12-10 21:49:09: keep=True reason=keep last 1 Backup #146 at 2023-12-10 21:36:10: keep=True reason=keep last 2 Backup #145 at 2023-12-10 21:26:25: keep=True reason=keep last 3 Backup #144 at 2023-12-10 21:21:22: keep=False reason=superseded by 145 (hour) Backup #143 at 2023-12-10 21:16:19: keep=False reason=superseded by 145 (hour) Backup #142 at 2023-12-10 21:11:14: keep=False reason=superseded by 145 (hour) Backup #141 at 2023-12-10 21:05:06: keep=False reason=superseded by 145 (hour) Backup #140 at 2023-12-10 21:00:03: keep=True reason=protected Backup #139 at 2023-12-10 20:55:01: keep=True reason=keep hour 1 Backup #138 at 2023-12-10 20:49:57: keep=False reason=superseded by 139 (hour) Backup #137 at 2023-12-10 20:44:53: keep=False reason=superseded by 139 (hour) Backup #136 at 2023-12-10 20:39:45: keep=False reason=superseded by 139 (hour) Backup #135 at 2023-12-10 20:34:41: keep=False reason=superseded by 139 (hour) Backup #128 at 2023-12-10 19:59:06: keep=True reason=keep hour 2 Backup #116 at 2023-12-10 18:56:14: keep=True reason=keep hour 3 Backup #104 at 2023-12-10 17:55:35: keep=False reason=superseded by 116 (day) Backup #22 at 2023-12-09 23:59:53: keep=True reason=keep day 1 ``` -------------------------------- ### Basic Prime Backup Configuration Setup (JSON) Source: https://context7.com/tisunion/primebackup/llms.txt Sets up essential Prime Backup configurations including enabling the plugin, debug mode, storage location, command prefix, server settings for saving worlds, and backup source, targets, and methods. ```json { "enabled": true, "debug": false, "storage_root": "./pb_files", "concurrency": 1, "command": { "prefix": "!!pb", "permission": { "root": 0, "abort": 1, "back": 2, "confirm": 1, "database": 4, "delete": 2, "delete_range": 3, "export": 4, "list": 1, "make": 1, "prune": 3, "rename": 2, "show": 1, "tag": 3 }, "confirm_time_wait": "1m", "backup_on_restore": true, "restore_countdown_sec": 10 }, "server": { "turn_off_auto_save": true, "commands": { "save_all_worlds": "save-all flush", "auto_save_off": "save-off", "auto_save_on": "save-on" }, "saved_world_regex": [ "Saved the game", "Saved the world" ], "save_world_max_wait": "10m" }, "backup": { "source_root": "./server", "targets": ["world"], "ignore_patterns": ["**/session.lock"], "retain_patterns": [], "hash_method": "xxh128", "compress_method": "zstd", "compress_threshold": 64 } } ``` -------------------------------- ### Backup Configuration Example (JSON) Source: https://github.com/tisunion/primebackup/blob/master/docs/config.md A sample JSON configuration object for PrimeBackup, illustrating settings for source directories, backup targets, ignored files, and compression methods. This configuration is used to define how backups are created and managed. ```json { "source_root": "./server", "source_root_use_mcdr_working_directory": false, "targets": [ "world" ], "ignored_files": [], "ignore_patterns": [ "**/session.lock" ], "retain_patterns": [], "follow_target_symlink": false, "reuse_stat_unchanged_file": false, "creation_skip_missing_file": false, "creation_skip_missing_file_patterns": [ "**" ], "hash_method": "xxh128", "compress_method": "zstd", "compress_threshold": 64, "fileset_allocate_lookback_count": 2 } ``` -------------------------------- ### Prime Backup CLI Tool Usage Source: https://github.com/tisunion/primebackup/blob/master/docs/cli.md This snippet demonstrates the basic usage of the Prime Backup CLI tool, showing available commands and global options. It requires a Python 3 interpreter and installed dependencies. ```bash $ python3 PrimeBackup.pyz usage: PrimeBackup.pyz [-h] [-d DB] {overview,list,show,import,export,extract,migrate_db} ... Prime Backup v1.7.0 CLI tools options: -h, --help show this help message and exit -d DB, --db DB Path to the prime_backup.db database file, or path to the directory that contains the prime_backup.db database file, e.g. "/my/path/prime_backup.db", or "/my/path" (default: ./pb_files) Command: {overview,list,show,import,export,extract,migrate_db} Available commands overview Show overview information of the database list List backups show Show detailed information of the given backup import Import a backup from the given file. The backup file needs to have a backup metadata file '.prime_backup.meta.json', or the --auto-meta flag need to be supplied export Export the given backup to a single file extract Extract a single file / directory from a backup migrate_db Migrate the database to the current version (2) ``` -------------------------------- ### Handle Ambiguous Blob Hash - PrimeBackup CLI Source: https://github.com/tisunion/primebackup/blob/master/docs/feature/database_inspect.md If the provided hash prefix is too short to uniquely identify a blob, PrimeBackup will report the ambiguity and list potential matching hashes. This prevents accidental inspection of the wrong blob and guides the user to provide a more specific hash. ```bash !!pb database inspect blob 8a ``` -------------------------------- ### Configure Conditional Backups Based on Online Players (Prime Backup) Source: https://github.com/tisunion/primebackup/blob/master/docs/config.md The `require_online_players` setting controls whether scheduled backups run only when players are online. If set to true, backups will be skipped if no players are detected after the first backup is created. This feature requires the Prime Backup plugin to be loaded before the server starts, unless MinecraftDataAPI is present. ```json { "require_online_players": true } ``` -------------------------------- ### PrimeBackup CLI List and Show Backups Source: https://context7.com/tisunion/primebackup/llms.txt List all backups or show details of a specific backup from the command line using the PrimeBackup.pyz tool. Requires specifying the database path. ```bash # List all backups python3 PrimeBackup.pyz -d pb_files list # Show details of a specific backup python3 PrimeBackup.pyz -d pb_files show 45 ``` -------------------------------- ### PrimeBackup CLI Overview Source: https://context7.com/tisunion/primebackup/llms.txt Use the Prime Backup .pyz file as a standalone CLI tool without MCDR. This command shows the CLI help, allows specifying the database location, and running various commands. ```bash # Show CLI help python3 PrimeBackup.pyz --help # Specify database location python3 PrimeBackup.pyz -d /path/to/pb_files # Example: View database overview python3 PrimeBackup.pyz -d run/pb_files overview # Output: # [2023-12-09 20:31:39,929 INFO] Storage root set to 'run/pb_files' # [2023-12-09 20:31:39,948 INFO] DB version: 1 # [2023-12-09 20:31:39,948 INFO] Hash method: xxh128 # [2023-12-09 20:31:39,948 INFO] Backup count: 2 # [2023-12-09 20:31:39,948 INFO] Blob count: 9108 # [2023-12-09 20:31:39,949 INFO] Blob stored size sum: 5158485126 (4.80GiB) # [2023-12-09 20:31:39,949 INFO] Blob raw size sum: 8295323157 (7.73GiB) ``` -------------------------------- ### Configure Backup Targets in JSON Source: https://github.com/tisunion/primebackup/blob/master/docs/quick_start.md Specifies the directories and files to be included in backups. Modify the 'world' entry to match your server's world directory name. For split world dimensions, list each dimension separately. ```json { "backup": { "targets": [ "world" ] } } ``` ```json { "backup": { "targets": [ "world", "world_nether", "world_the_end" ] } } ``` -------------------------------- ### Database Overview with PrimeBackup Source: https://context7.com/tisunion/primebackup/llms.txt View comprehensive statistics about the Prime Backup database. This includes database version, file size, hash method, backup count, file counts, and blob statistics. ```bash !!pb database overview # Example output: # [PB] ======== Database overview ======== # [PB] Database version: 3 # [PB] Database file size: 2.67MiB # [PB] Hash method: xxh128 # [PB] Backup count: 22 # [PB] File count: 70469 (9190 objects) # [PB] File raw size sum: 2.50GiB # [PB] Blob count: 4339 # [PB] Blob stored size sum: 451.68MiB (68.7%) # [PB] Blob raw size sum: 657.79MiB ``` -------------------------------- ### Import Backup from Archive (Bash) Source: https://context7.com/tisunion/primebackup/llms.txt Imports a backup from an archive file into the specified destination directory. Supports automatic metadata generation if the metadata file is not present. ```bash python3 PrimeBackup.pyz -d pb_files import backup.tar python3 PrimeBackup.pyz -d pb_files import backup.tar --auto-meta ``` -------------------------------- ### Show Backup Details with PrimeBackup Source: https://context7.com/tisunion/primebackup/llms.txt View detailed information about a specific backup using its ID. The output includes creation date, comment, stored and raw size, creator, and tags. ```bash # Show details for backup #45 !!pb show 45 # Example output: # [PB] ======== Backup #45 ======== # [PB] Creation date: 2025-08-24 23:50:07 # [PB] Comment: My important backup # [PB] Size (stored): 64.62MiB (54.6%) # [PB] Size (raw): 118.39MiB # [PB] Creator: Console # [PB] Tags: empty ``` -------------------------------- ### List Backups with PrimeBackup Source: https://context7.com/tisunion/primebackup/llms.txt View the backup list with various filtering and sorting options. This command allows listing backups with options for pagination, sorting by ID, filtering by creator or date range, and showing all backups including hidden and temporary ones. ```bash # List most recent 10 backups !!pb list # List 20 backups per page !!pb list --per-page 20 # View page 2 !!pb list 2 # Sort by ID ascending !!pb list --sort id # Filter by creator !!pb list --creator console: !!pb list --creator player:Fallen_Breath !!pb list --me # Filter by date range !!pb list --from 20240101 --to 20240131 # Show all backups including hidden and temporary !!pb list --all --flags # Example output: # [PB] ======== Backup List ======== # [PB] There are 17 backups: # [PB] [#85] 162.45MiB 2025-01-31 23:59:59: Final backup of January # [PB] [#84] 159.82MiB 2025-01-30 16:45:30: Building completed # [PB] [#83] 157.36MiB 2025-01-28 12:15:45: Storage restructure # [PB] <- 1/2 -> ``` -------------------------------- ### Run PrimeBackup Fixer Script Source: https://github.com/tisunion/primebackup/blob/master/tools/README.md Executes the `issue_64_fixer.py` script to repair PrimeBackup instances. It requires paths to the PrimeBackup plugin, instance directory, database backups, and optionally blob backups. The script validates filesets, recovers database entries, and rebuilds missing blob objects and files. ```bash python3 ./issue_64_fixer.py \ --pb-plugin /path/to/PrimeBackup-v1.9.4.pyz \ --pb-dir /path/to/pb_files \ --db-backup-dir ./db_backups \ --blobs-backup-dir ./blobs_backups ``` -------------------------------- ### Prime Backup CLI Tool - Main Usage Source: https://github.com/tisunion/primebackup/blob/master/docs/cli.md This section outlines the primary usage of the Prime Backup CLI tool, including global options and available commands. ```APIDOC ## PrimeBackup.pyz - Main Usage ### Description The Prime Backup CLI tool allows users to manage backups directly from the command line. It supports various operations such as viewing overview information, listing backups, importing, exporting, and extracting backup files. ### Method `python3` ### Endpoint `PrimeBackup.pyz` ### Parameters #### Global Options: - **-h, --help** (boolean) - Optional - Show this help message and exit. - **-d DB, --db DB** (string) - Optional - Path to the prime_backup.db database file, or path to the directory that contains the prime_backup.db database file (default: ./pb_files). #### Commands: - **overview**: Show overview information of the database. - **list**: List backups. - **show**: Show detailed information of the given backup. - **import**: Import a backup from the given file. The backup file needs to have a backup metadata file '.prime_backup.meta.json', or the --auto-meta flag need to be supplied. - **export**: Export the given backup to a single file. - **extract**: Extract a single file / directory from a backup. - **migrate_db**: Migrate the database to the current version (2). ### Request Example ```bash $ python3 PrimeBackup.pyz -d run/pb_files overview ``` ### Response #### Success Response (Output varies based on command) - **Output**: Text-based output detailing the requested information (e.g., database overview, backup list, etc.). #### Response Example (Overview Command) ``` [2023-12-09 20:31:39,929 INFO] Storage root set to 'run/pb_files' [2023-12-09 20:31:39,948 INFO] DB version: 1 [2023-12-09 20:31:39,948 INFO] Hash method: xxh128 [2023-12-09 20:31:39,948 INFO] Backup count: 2 [2023-12-09 20:31:39,948 INFO] Blob count: 9108 [2023-12-09 20:31:39,948 INFO] Blob stored size sum: 5158485126 (4.80GiB) [2023-12-09 20:31:39,949 INFO] Blob raw size sum: 8295323157 (7.73GiB) [2023-12-09 20:31:39,949 INFO] File count: 22010 [2023-12-09 20:31:39,949 INFO] File raw size sum: 16610326638 (15.47GiB) ``` ``` -------------------------------- ### Configure Hashing and Compression Methods in JSON Source: https://github.com/tisunion/primebackup/blob/master/docs/quick_start.md Sets the algorithms for hashing files and compressing backup data. 'hash_method' options include 'xxh128', 'sha256', and 'blake3'. 'compress_method' options include 'plain' and 'zstd'. ```json { "backup": { "hash_method": "xxh128", "compress_method": "zstd" } } ``` -------------------------------- ### Enable Prime Backup Plugin in JSON Source: https://github.com/tisunion/primebackup/blob/master/docs/quick_start.md Enables the Prime Backup plugin by setting the 'enabled' option to 'true' in the root configuration object. ```json { "enabled": true } ``` -------------------------------- ### Migrate Hash/Compress Method with PrimeBackup Source: https://context7.com/tisunion/primebackup/llms.txt Change the hash or compression method for existing backups. The hash method cannot be changed directly in the config and requires migration. ```bash # Migrate hash method (cannot be changed directly in config) !!pb database migrate_hash_method sha256 # Migrate compression method !!pb database migrate_compress_method lz4 ``` -------------------------------- ### Export Backup with Options (Bash) Source: https://context7.com/tisunion/primebackup/llms.txt Exports a backup from a specified source to an archive file. Supports various archive formats and options like soft failure and skipping verification. The destination directory for backup files is specified with -d. ```bash python3 PrimeBackup.pyz -d pb_files export 45 backup.tar --fail-soft --no-verify --no-meta ``` -------------------------------- ### Create Backup in MCDR Environment Source: https://github.com/tisunion/primebackup/blob/master/docs/feature/backup_create.md This command initiates the backup creation process within the MCDR environment. It's a single command that triggers the saving of the game state and files. The output shows the progress and completion of the backup, including file scanning and size information. ```plaintext !!pb make ``` -------------------------------- ### Prune Configuration with PBS-Style Retention Policy (JSON) Source: https://context7.com/tisunion/primebackup/llms.txt Configures automatic backup pruning using PBS-style retention policies, defining retention rules for both regular and temporary backups based on amount and lifetime. ```json { "prune": { "enabled": true, "interval": "3h", "crontab": null, "jitter": "20s", "timezone_override": null, "regular_backup": { "enabled": true, "max_amount": 0, "max_lifetime": "0s", "last": 3, "hour": 24, "day": 7, "week": 4, "month": 12, "year": 0 }, "temporary_backup": { "enabled": true, "max_amount": 10, "max_lifetime": "30d", "last": -1, "hour": 0, "day": 0, "week": 0, "month": 0, "year": 0 } } } ``` -------------------------------- ### Prime Backup Export Command Help Source: https://github.com/tisunion/primebackup/blob/master/docs/cli.md This snippet displays the help message for the 'export' subcommand of the Prime Backup CLI tool. It details the positional arguments and available options for exporting backups. ```bash $ python3 PrimeBackup.pyz export --help usage: PrimeBackup.pyz export [-h] [-f FORMAT] [--fail-soft] [--no-verify] [--no-meta] backup_id output Export the given backup to a single file positional arguments: backup_id The ID of the backup to export. Besides an integer ID, it can also be "latest" and "latest_non_temp" output The output file name of the exported backup. Example: my_backup.tar options: -h, --help show this help message and exit -f FORMAT, --format FORMAT The format of the output file. If not given, attempt to infer from the output file name. Options: tar, tar_gz, tar_bz2, tar_xz, tar_zst, zip --fail-soft Skip files with export failure in the backup, so a single failure will not abort the export. Notes: a corrupted file might damaged the tar-based file --no-verify Do not verify the exported file contents --no-meta Do not add the backup metadata file '.prime_backup.meta.json' in the exported file ``` -------------------------------- ### View Blob Details with Hash - PrimeBackup CLI Source: https://github.com/tisunion/primebackup/blob/master/docs/feature/database_inspect.md This command allows you to retrieve comprehensive details about a specific blob stored in the PrimeBackup database. You can use the full blob hash or a unique prefix of it. The output includes the blob's hash, compression type, raw and stored sizes, and associated file paths. ```bash !!pb database inspect blob ``` ```bash !!pb database inspect blob 8a3d ``` ```bash !!pb database inspect blob 8a3d32b705a1274850798ae26ff56ba9 ``` -------------------------------- ### Migrate Database Schema (Bash) Source: https://context7.com/tisunion/primebackup/llms.txt Migrates the PrimeBackup database schema to the current version. This is typically run after updating the PrimeBackup tool to ensure database compatibility. ```bash python3 PrimeBackup.pyz -d pb_files migrate_db ``` -------------------------------- ### Command Configuration (JSON) Source: https://github.com/tisunion/primebackup/blob/master/docs/config.md Defines settings related to command execution within Prime Backup. This includes the command prefix, permission levels required for various subcommands, confirmation time for sensitive operations, and whether to perform automatic backups before restoring. ```json { "prefix": "!!pb", "permission": { "root": 0, "abort": 1, "back": 2, "confirm": 1, "database": 4, "delete": 2, "delete_range": 3, "export": 4, "list": 1, "make": 1, "prune": 3, "rename": 2, "show": 1, "tag": 3 }, "confirm_time_wait": "1m", "backup_on_restore": true, "restore_countdown_sec": 10 } ``` -------------------------------- ### Restore Backup with PrimeBackup Source: https://context7.com/tisunion/primebackup/llms.txt Restore the server world to a previous backup state. The server will be stopped during restoration. Options include restoring to the latest backup, a specific backup ID, a backup relative to the latest, skipping confirmation, and disabling content verification. ```bash # Restore to latest non-temporary backup !!pb back # Restore to specific backup ID !!pb back 78 # Restore to backup before the latest !!pb back ~1 # Restore 3 backups before the latest !!pb back ~3 # Skip confirmation and use fail-soft mode !!pb back 12 --confirm --fail-soft # Restore without content verification !!pb back 45 --no-verify # After running !!pb back, confirm with: !!pb confirm # Or abort with: !!pb abort ``` -------------------------------- ### Configure Crontab Job Settings (JSON) Source: https://github.com/tisunion/primebackup/blob/master/docs/config.md This JSON configuration defines the parameters for a crontab job, including whether it's enabled, the execution interval or crontab schedule, and a jitter value to randomize execution times. The 'enabled' field is a boolean, 'interval' and 'crontab' are mutually exclusive string or null values, and 'jitter' is a string representing a time duration. ```json { "enabled": true, "interval": "1h", "crontab": null, "jitter": "10s" } ``` -------------------------------- ### Create Backup with Comment in MCDR Environment Source: https://github.com/tisunion/primebackup/blob/master/docs/feature/backup_create.md This command allows users to create a backup and simultaneously add a descriptive comment for easier identification later. The comment is appended directly after the backup command. This feature helps in organizing and retrieving specific backups. ```plaintext !!pb make ``` ```plaintext !!pb make Example Comment Here ``` -------------------------------- ### Database Maintenance with PrimeBackup Source: https://context7.com/tisunion/primebackup/llms.txt Perform database maintenance tasks such as pruning orphaned data and compacting the database to reclaim disk space. ```bash # Prune orphaned blobs, files, and filesets !!pb database prune # Compact SQLite database to reclaim disk space !!pb database vacuum ``` -------------------------------- ### Bukkit Server World Dimension Configuration (JSON) Source: https://context7.com/tisunion/primebackup/llms.txt Configures Prime Backup to include multiple world dimensions commonly found in Bukkit-like servers, such as nether and the end, in the backup targets. ```json { "backup": { "targets": [ "world", "world_nether", "world_the_end" ] } } ``` -------------------------------- ### Prime Backup CLI Tool - Export Command Source: https://github.com/tisunion/primebackup/blob/master/docs/cli.md Detailed usage for the 'export' command, including its parameters and options for exporting backups. ```APIDOC ## PrimeBackup.pyz export - Export Backup ### Description Exports a specified backup to a single file. Users can control the output format, error handling during file export, and whether to include metadata. ### Method `python3` ### Endpoint `PrimeBackup.pyz export` ### Parameters #### Positional Arguments: - **backup_id** (string) - Required - The ID of the backup to export. Can be an integer ID, "latest", or "latest_non_temp". - **output** (string) - Required - The output file name of the exported backup (e.g., my_backup.tar). #### Options: - **-h, --help** (boolean) - Optional - Show this help message and exit. - **-f FORMAT, --format FORMAT** (string) - Optional - The format of the output file. If not given, attempt to infer from the output file name. Options: tar, tar_gz, tar_bz2, tar_xz, tar_zst, zip. - **--fail-soft** (boolean) - Optional - Skip files with export failure in the backup, so a single failure will not abort the export. Notes: a corrupted file might damage the tar-based file. - **--no-verify** (boolean) - Optional - Do not verify the exported file contents. - **--no-meta** (boolean) - Optional - Do not add the backup metadata file '.prime_backup.meta.json' in the exported file. ### Request Example ```bash $ python3 PrimeBackup.pyz export --format tar_gz latest my_latest_backup.tar.gz ``` ### Response #### Success Response (200) - **Output**: The exported backup file is created at the specified output path. #### Response Example (No specific JSON response, output is the created file.) ``` -------------------------------- ### Validate All PrimeBackup Database Components Source: https://github.com/tisunion/primebackup/blob/master/docs/feature/database_maintain.md Performs a comprehensive validation of all database components in PrimeBackup, including blobs, files, filesets, and backups. This command provides a complete check of database consistency. ```bash !!pb database validate all ``` -------------------------------- ### View Fileset Details - Prime Backup CLI Source: https://github.com/tisunion/primebackup/blob/master/docs/feature/database_inspect.md Displays complete information for a specific fileset, identified by its ID. This command is useful for understanding the contents and properties of individual filesets. ```bash !!pb database inspect fileset !!pb database inspect fileset 87 ``` -------------------------------- ### Scheduled Backup Configuration (JSON) Source: https://context7.com/tisunion/primebackup/llms.txt Enables and configures automatic scheduled backups for Prime Backup, allowing for backups at specified intervals or using crontab-style scheduling, with options for jitter and timer resets. ```json { "scheduled_backup": { "enabled": true, "interval": "12h", "crontab": null, "jitter": "10s", "reset_timer_on_backup": true, "require_online_players": false, "require_online_players_blacklist": [] } } ``` -------------------------------- ### PrimeBackup CLI Export Backup Source: https://context7.com/tisunion/primebackup/llms.txt Export a backup to an archive file using the PrimeBackup.pyz tool. Supports exporting to tar, tar.zst, or zip formats, and allows exporting the latest backup. ```bash # Export backup to tar file python3 PrimeBackup.pyz -d pb_files export 45 my_backup.tar # Export with specific format python3 PrimeBackup.pyz -d pb_files export 45 backup.tar.zst -f tar_zst # Export latest backup python3 PrimeBackup.pyz -d pb_files export latest backup.zip ``` -------------------------------- ### Root Configuration Structure (JSON) Source: https://github.com/tisunion/primebackup/blob/master/docs/config.md The main configuration object for Prime Backup. It includes global settings like enabling/disabling the plugin, debug mode, storage root, and concurrency. It also defines sub-configurations for commands, server interactions, backup operations, scheduled backups, pruning, and database settings. ```json { "enabled": true, "debug": false, "storage_root": "./pb_files", "concurrency": 1, "command": {/* Command config */}, "server": {/* Server config */}, "backup": {/* Backup config */}, "scheduled_backup": {/* Scheduled backup config */}, "prune": {/* Prune config */}, "database": {/* Database config */} } ```