{"id":31389846,"url":"https://github.com/xhdndmm/mcbackup","last_synced_at":"2026-05-13T00:32:58.685Z","repository":{"id":312276890,"uuid":"1046900525","full_name":"xhdndmm/mcbackup","owner":"xhdndmm","description":"一个自动备份MC服务器至123云盘的程序","archived":false,"fork":false,"pushed_at":"2026-03-20T10:56:01.000Z","size":73,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-21T03:29:32.949Z","etag":null,"topics":["123pan","autobackup","backup","cloud-backup","gplv3","linux-app","mcsm","mcsmanager","minecraft","p7zip","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xhdndmm.png","metadata":{"files":{"readme":"README-EN.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-29T12:10:04.000Z","updated_at":"2026-03-02T12:48:18.000Z","dependencies_parsed_at":"2025-08-29T16:39:10.403Z","dependency_job_id":"12b5f59f-4845-4092-9cf0-1c7b7e7500a6","html_url":"https://github.com/xhdndmm/mcbackup","commit_stats":null,"previous_names":["cat-cat-studio/mcbackup","xhdndmm/mcbackup"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/xhdndmm/mcbackup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xhdndmm%2Fmcbackup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xhdndmm%2Fmcbackup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xhdndmm%2Fmcbackup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xhdndmm%2Fmcbackup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xhdndmm","download_url":"https://codeload.github.com/xhdndmm/mcbackup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xhdndmm%2Fmcbackup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32963162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T23:30:32.555Z","status":"ssl_error","status_checked_at":"2026-05-12T23:30:18.191Z","response_time":102,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["123pan","autobackup","backup","cloud-backup","gplv3","linux-app","mcsm","mcsmanager","minecraft","p7zip","python","python3"],"created_at":"2025-09-29T00:47:17.041Z","updated_at":"2026-05-13T00:32:58.660Z","avatar_url":"https://github.com/xhdndmm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Welcome to this Project!\n\n## What is this?\nA Minecraft server automated backup tool based on **Python + MCSManager API + 123Pan Cloud Drive API**.\n\nFeatures:\n- Automatically generates `config.json` on first run\n- Supports two backup modes:\n  - **Cold backup (cold)**: stop server → compress → start server\n  - **Hot backup (hot)**: save-off → save-all → compress world folder → save-on (no shutdown required)\n- Uses `7z` to compress the server directory\n- Server resumes normal operation immediately after compression, while **uploading runs in a background thread**\n- Uploads to **123Pan Cloud Drive** (via official Open Platform API)\n- Supports multiple scheduled **backup times**\n- Supports **log rotation** for long-term stability\n\n---\n\n## Requirements\n\n- Operating System: Linux  \n- Python version: `\u003e= 3.8`  \n- [MCSManager Panel](https://mcsmanager.com/)  \n- System dependencies:\n```bash\nsudo apt update \u0026\u0026 sudo apt install p7zip-full\n```\n\n- Python dependencies:\n\n```bash\npip install -r requirements.txt\n```\n\n---\n\n## Configuration File (`config.json`)\n\nThe script will automatically generate a sample config file on the first run and exit.\nYou need to manually modify it.\n\n```json\n{\n  \"mcsmanager\": {\n    \"base_url\": \"http://panel.example.com\", \n    \"apikey\": \"YOUR_MCSM_APIKEY\",\n    \"daemonId\": \"your-daemon-id\",\n    \"instance_uuid\": \"your-instance-uuid\"\n  },\n  \"server\": {\n    \"server_dir\": \"/home/mc/server\",\n    \"backup_dir\": \"/home/mc/backups\",\n    \"compress_cmd\": \"7z\",\n    \"compress_args\": [\"a\", \"-mx=9\"]\n  },\n  \"123pan_http\": {\n    \"api_base_url\": \"https://open-api.123pan.com\",\n    \"client_id\": \"YOUR_123PAN_CLIENT_ID\",\n    \"client_secret\": \"YOUR_123PAN_CLIENT_SECRET\",\n    \"parent_folder_id\": 0\n  },\n  \"schedule\": {\n    \"times\": [\"03:00\", \"15:00\"],\n    \"timezone\": \"Asia/Shanghai\"\n  },\n  \"logging\": {\n    \"log_file\": \"mc_backup.log\",\n    \"max_bytes\": 10485760,\n    \"backup_count\": 5\n  },\n  \"backup\": {\n    \"mode\": \"cold\",\n    \"keep_days\": 7,\n    \"keep_count\": 10,\n    \"storage\": \"both\"\n  }\n}\n```\n\n**Note: Version 2.x configuration format has changed. The above sample is for version 2.x.**\n\n---\n\n## Usage\n\n### 1. First run\n\n```bash\npython3 backup.py\n```\n\nThis creates `config.json` and exits.\n\n### 2. Edit the configuration file\n\n* Fill in the MCSManager API address, apikey, node ID, instance ID\n* Provide the `client_id` and `client_secret` for 123Pan\n\u003e [!TIP]\n\u003e\n\u003e You can apply for 123Pan API at: [https://www.123pan.com/developer](https://www.123pan.com/developer)\n* Choose `cold` or `hot` backup mode\n\n### 3. Run again\n\n```bash\npython3 backup.py\n```\n\nThe program will stay running and trigger backups according to `schedule.times`.\n\n---\n\n## Backup Process\n\n### Cold Backup (cold)\n\n1. Stop server via **MCSManager API**\n2. Compress server directory using `7z`\n3. **Restart server immediately**\n4. Upload compressed file to **123Pan** in a background thread\n\n### Hot Backup (hot)\n\n1. Send `save-off`\n2. Send `save-all`\n3. Compress server directory\n4. Send `save-on`\n5. Upload in background\n\n---\n\n## Logs\n\n* Default log file: `mc_backup.log`\n* Rotates when size exceeds 10MB, keeping 5 older logs\n* Check logs:\n\n  ```bash\n  cat mc_backup.log\n  ```\n\n---\n\n## Scheduled Tasks\n\n* Implemented using `apscheduler`\n* Time format: `HH:MM` (24-hour)\n* Supports multiple backup times:\n\n  ```json\n  \"times\": [\"03:00\", \"12:00\", \"21:00\"]\n  ```\n\nThe script remains running and triggers at these times.\n\n---\n\n## Running in Background\n\nYou may use **systemd** or **tmux**.\n\n### Example systemd service\n\nCreate `/etc/systemd/system/mcbackup.service`:\n\n```ini\n[Unit]\nDescription=Minecraft Backup Service\nAfter=network.target\n\n[Service]\nWorkingDirectory=/path/to/backup\nExecStart=/path/to/python3 /path/to/backup/backup.py\nRestart=always\nUser=mc\n\n[Install]\nWantedBy=multi-user.target\n```\n\nActivate service:\n\n```bash\nsudo systemctl daemon-reload\nsudo systemctl enable mcbackup\nsudo systemctl start mcbackup\n```\n\n---\n\n## Notes\n\n* The uploading process uses the `pan123` SDK, which calls the 123Pan official API for multipart uploads\n* For large files, the server will already be back online while uploading\n* If upload fails, the compressed backup still remains in `backup_dir`\n* **Check log files periodically to confirm upload success**\n\n---\n\n## Contributing\n\nIf you'd like to contribute, it's recommended to use [VS Code](https://code.visualstudio.com/).\nPlease submit PRs to the **dev** branch.\n\n---\n\n## Issue Feedback\n\nReport issues here:\n[https://github.com/xhdndmm/mcbackup/issues](https://github.com/xhdndmm/mcbackup/issues)\n\n---\n\n## License\n\nThis project is licensed under the **GPLv3** license:\n[https://www.gnu.org/licenses/gpl-3.0.html](https://www.gnu.org/licenses/gpl-3.0.html)\n\n---\nTranslated by ChatGPT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxhdndmm%2Fmcbackup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxhdndmm%2Fmcbackup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxhdndmm%2Fmcbackup/lists"}