{"id":16366863,"url":"https://github.com/centminmod/centminmod-borgbackups","last_synced_at":"2026-01-23T07:34:43.978Z","repository":{"id":80279530,"uuid":"195799094","full_name":"centminmod/centminmod-borgbackups","owner":"centminmod","description":null,"archived":false,"fork":false,"pushed_at":"2022-07-10T22:58:03.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T17:51:59.350Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/centminmod.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2019-07-08T11:32:13.000Z","updated_at":"2023-11-08T07:52:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"e927617b-08ab-44c3-987f-c28c4d70464f","html_url":"https://github.com/centminmod/centminmod-borgbackups","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/centminmod/centminmod-borgbackups","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centminmod%2Fcentminmod-borgbackups","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centminmod%2Fcentminmod-borgbackups/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centminmod%2Fcentminmod-borgbackups/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centminmod%2Fcentminmod-borgbackups/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/centminmod","download_url":"https://codeload.github.com/centminmod/centminmod-borgbackups/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centminmod%2Fcentminmod-borgbackups/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28683459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"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":[],"created_at":"2024-10-11T02:47:49.085Z","updated_at":"2026-01-23T07:34:43.962Z","avatar_url":"https://github.com/centminmod.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# addons/borgbackups.sh for Centmin Mod 123.09beta01\n\nCentmin Mod 123.09beta01 and newer version addon for [borgbackups](https://borgbackup.readthedocs.io/en/stable/index.html). By default non site directories are backed up for Centmin Mod LEMP stack server's environment directories that directly Centmin Mod as defined by space separated list of directories defined in `BORG_BACKUPTARGETS` variable. `addons/borgbackups.sh` uses zstd compression level 6 by default for creating borg backup repos.\n\n```\nBORG_BACKUPTARGETS='/root/.ssh /root/tools /root/centminlogs /usr/local/nginx/conf /usr/local/nginx/conf/conf.d /etc/centminmod'\n```\n\nYou could add `/home/nginx/domains` to that list if you want to backup Nginx vhost domain sites too.\n\n```\nBORG_BACKUPTARGETS='/home/nginx/domains /root/.ssh /root/tools /root/centminlogs /usr/local/nginx/conf /usr/local/nginx/conf/conf.d /etc/centminmod'\n```\n\n## usage options\n\n* install - install borgbackup yum package and setup and initialize the borg repository at `/home/borgbackups`\n* backup - run borg backup to create repos for defined `BORG_BACKUPTARGETS` space separated list of directories\n* cleanup - wipes and removes all borg backup config and repos\n* reset-passphrase - reset and change the borgbackup repo's passphrase via reset-passphrase command option by passing your new desired passphrase i.e. `NEW_PASSPHRASE`\n\n```\nUsage:\n\n./borgbackups.sh install\n./borgbackups.sh backup\n./borgbackups.sh cleanup\n./borgbackups.sh reset-passphrase NEW_PASSPHRASE\n```\n\nYou can setup a cronjob schedule every 24 hrs at 1:15 AM via crontab\n\n```\n15 1 * * * /usr/local/src/centminmod/addons/borgbackups.sh backup \u003e/dev/null 2\u003e\u00261\n```\n\nborgbackups.sh is written to prune older borg backups according to the following retention schedule\n\n```\n# borg prune how long to keep backups before removal\nBORG_KEEP_HOURLY='24'\nBORG_KEEP_DAILY='7'\nBORG_KEEP_WEEKLY='4'\nBORG_KEEP_MONTHLY='12'\n```\nSo it will keep\n\n* the last 24 hourly backups if you setup a hourly cronjob schedule\n* the last 7 days backups if you setup a daily cronjob schedule\n* the last 4 weeks of backups\n* the last 12 monthly backups\n\n## config options\n\n`addons/borgbackups.sh` has the following config options.\n\n```\n# space separated list of directories to keep borg\n# incremental deduplicated backups for\nBORG_BACKUPTARGETS='/root/.ssh /root/tools /root/centminlogs /usr/local/nginx/conf /usr/local/nginx/conf/conf.d /etc/centminmod'\n\n# where borgbackups.sh logs get saved\nBORG_BACKUPLOGS='/home/borgbackups-logs'\n\n# where your backups get stored with encryption\nBORG_REPO='/home/borgbackups'\n\n# your desired borg encryption passphrase if left blank\n# passphrase will be auto generated for you and you'll\n# need this passphrase to access your borg backups\n# auto generated passphrase is saved to \n# /root/.config/borg/pp\nBORG_PASSPHRASE=''\n\n# set borgbackup to reserve additional free space in\n# gigabytes to prevent running out of disk space\nBORG_ADDITIONAL_FREESPACE='4G'\n\n# borg prune how long to keep backups before removal\nBORG_KEEP_HOURLY='24'\nBORG_KEEP_DAILY='7'\nBORG_KEEP_WEEKLY='4'\nBORG_KEEP_MONTHLY='12'\n```\n\n## email notifications\n\nYou can set borg backup runs to email notify you when done - setting `BORG_EMAIL_SEND='y'`\n\n```\n# EMAIL SECTION\nBORG_EMAIL_SEND='n'\nBORG_EMAIL='youremailaddress'\n```\n\n## config override options\n\nYou can override `borgbackups.sh` config variables via the following setting files you can create if they do not already exist allowing you to leave `borgsbackups.sh` untouched without edits for easier upgrades. You move custom variables into either of these settings files instead.\n\n* `/etc/centminmod/borgbackups.ini` - this is settings config file specific for `borgbackups.sh` and will override any settings set in `/etc/centminmod/custom_config.inc`\n* `/etc/centminmod/custom_config.inc` - this is Centmin Mod 123.09beta01 or newer's persistent config file that can also override [centmin.sh menu option variables](https://centminmod.com/menu.html).\n\n## borgbackups.sh install\n\nTo install and setup borgbackups run SSH command\n\n```\n./borgbackups.sh install\nsource /root/.bashrc\nborg info\n```\n\n```\nborg info               \nRepository ID: 97a25e149c89a17ca4d5fb50b10820461b63812eceb77f34b0d3499a1cf5ecec\nLocation: /home/borgbackups\nEncrypted: Yes (repokey BLAKE2b)\nCache: /root/.cache/borg/97a25e149c89a17ca4d5fb50b10820461b63812eceb77f34b0d3499a1cf5ecec\nSecurity dir: /root/.config/borg/security/97a25e149c89a17ca4d5fb50b10820461b63812eceb77f34b0d3499a1cf5ecec\n------------------------------------------------------------------------------\n                       Original size      Compressed size    Deduplicated size\nAll archives:                    0 B                  0 B                  0 B\n\n                       Unique chunks         Total chunks\nChunk index:                       0                    0\n```\n\n## backup example\n\nExample backup run using wrapper script for [borg create](https://borgbackup.readthedocs.io/en/stable/usage/create.html) commands.\n\n```\n./borgbackups.sh backup                   \nborgbackup for .ssh\n------------------------------------------------------------------------------\nArchive name: .ssh-080719-131709\nArchive fingerprint: 8c03640c4d14b354639c3bd4778d53918ac6d54c05c8beb073fc8c75583ac401\nTime (start): Mon, 2019-07-08 13:17:10\nTime (end):   Mon, 2019-07-08 13:17:10\nDuration: 0.02 seconds\nNumber of files: 5\nUtilization of max. archive size: 0%\n------------------------------------------------------------------------------\n                       Original size      Compressed size    Deduplicated size\nThis archive:                3.74 kB              2.60 kB              2.60 kB\nAll archives:                3.74 kB              2.60 kB              2.60 kB\n\n                       Unique chunks         Total chunks\nChunk index:                       7                    7\n------------------------------------------------------------------------------\n------------------------------------------------------------------------------\n                       Original size      Compressed size    Deduplicated size\nDeleted data:                    0 B                  0 B                  0 B\nAll archives:                3.74 kB              2.60 kB              2.60 kB\n\n                       Unique chunks         Total chunks\nChunk index:                       7                    7\n------------------------------------------------------------------------------\nborgbackup for tools\n------------------------------------------------------------------------------\nArchive name: tools-080719-131711\nArchive fingerprint: 854837240e494ec06871cda3df6ed3a514da7b0abccd785121abeae31567d86e\nTime (start): Mon, 2019-07-08 13:17:11\nTime (end):   Mon, 2019-07-08 13:17:40\nDuration: 28.47 seconds\nNumber of files: 1975\nUtilization of max. archive size: 0%\n------------------------------------------------------------------------------\n                       Original size      Compressed size    Deduplicated size\nThis archive:              569.34 MB            209.25 MB            207.61 MB\nAll archives:              569.35 MB            209.26 MB            207.61 MB\n\n                       Unique chunks         Total chunks\nChunk index:                    1763                 2129\n------------------------------------------------------------------------------\n------------------------------------------------------------------------------\n                       Original size      Compressed size    Deduplicated size\nDeleted data:                    0 B                  0 B                  0 B\nAll archives:              569.35 MB            209.26 MB            207.61 MB\n\n                       Unique chunks         Total chunks\nChunk index:                    1763                 2129\n------------------------------------------------------------------------------\nborgbackup for centminlogs\n------------------------------------------------------------------------------\nArchive name: centminlogs-080719-131741\nArchive fingerprint: 51407a0630126fa66e04022020bf7e122478dec717fb965d41393956d467cf2d\nTime (start): Mon, 2019-07-08 13:17:42\nTime (end):   Mon, 2019-07-08 13:17:43\nDuration: 1.42 seconds\nNumber of files: 1028\nUtilization of max. archive size: 0%\n------------------------------------------------------------------------------\n                       Original size      Compressed size    Deduplicated size\nThis archive:               94.98 MB              9.01 MB            133.65 kB\nAll archives:              664.33 MB            218.27 MB            207.75 MB\n\n                       Unique chunks         Total chunks\nChunk index:                    1832                 3119\n------------------------------------------------------------------------------\n------------------------------------------------------------------------------\n                       Original size      Compressed size    Deduplicated size\nDeleted data:                    0 B                  0 B                  0 B\nAll archives:              664.33 MB            218.27 MB            207.75 MB\n\n                       Unique chunks         Total chunks\nChunk index:                    1832                 3119\n------------------------------------------------------------------------------\nborgbackup for conf\n------------------------------------------------------------------------------\nArchive name: conf-080719-131744\nArchive fingerprint: 7cdcbd951dc099c2a4483f3c64163427c0c1288a0c93b8401d29441a74594801\nTime (start): Mon, 2019-07-08 13:17:45\nTime (end):   Mon, 2019-07-08 13:17:45\nDuration: 0.26 seconds\nNumber of files: 239\nUtilization of max. archive size: 0%\n------------------------------------------------------------------------------\n                       Original size      Compressed size    Deduplicated size\nThis archive:              678.10 kB            223.70 kB            147.82 kB\nAll archives:              665.01 MB            218.49 MB            207.89 MB\n\n                       Unique chunks         Total chunks\nChunk index:                    1976                 3334\n------------------------------------------------------------------------------\n------------------------------------------------------------------------------\n                       Original size      Compressed size    Deduplicated size\nDeleted data:                    0 B                  0 B                  0 B\nAll archives:              665.01 MB            218.49 MB            207.89 MB\n\n                       Unique chunks         Total chunks\nChunk index:                    1976                 3334\n------------------------------------------------------------------------------\nborgbackup for conf.d\n------------------------------------------------------------------------------\nArchive name: conf.d-080719-131746\nArchive fingerprint: 9d9bbd04f2514265b7317808a2104610da1d3f1f4fb9a1c1277fec9a11412f2e\nTime (start): Mon, 2019-07-08 13:17:46\nTime (end):   Mon, 2019-07-08 13:17:46\nDuration: 0.04 seconds\nNumber of files: 13\nUtilization of max. archive size: 0%\n------------------------------------------------------------------------------\n                       Original size      Compressed size    Deduplicated size\nThis archive:               49.70 kB             18.12 kB              1.81 kB\nAll archives:              665.06 MB            218.51 MB            207.90 MB\n\n                       Unique chunks         Total chunks\nChunk index:                    1978                 3349\n------------------------------------------------------------------------------\n------------------------------------------------------------------------------\n                       Original size      Compressed size    Deduplicated size\nDeleted data:                    0 B                  0 B                  0 B\nAll archives:              665.06 MB            218.51 MB            207.90 MB\n\n                       Unique chunks         Total chunks\nChunk index:                    1978                 3349\n------------------------------------------------------------------------------\nborgbackup for centminmod\n------------------------------------------------------------------------------\nArchive name: centminmod-080719-131747\nArchive fingerprint: fe7b9ede09237873f7fd90bd516017b75345d55539dc70e2e963981ef836664f\nTime (start): Mon, 2019-07-08 13:17:48\nTime (end):   Mon, 2019-07-08 13:17:48\nDuration: 0.11 seconds\nNumber of files: 74\nUtilization of max. archive size: 0%\n------------------------------------------------------------------------------\n                       Original size      Compressed size    Deduplicated size\nThis archive:               44.45 kB             24.81 kB              8.05 kB\nAll archives:              665.10 MB            218.53 MB            207.90 MB\n\n                       Unique chunks         Total chunks\nChunk index:                    2002                 3425\n------------------------------------------------------------------------------\n------------------------------------------------------------------------------\n                       Original size      Compressed size    Deduplicated size\nDeleted data:                    0 B                  0 B                  0 B\nAll archives:              665.10 MB            218.53 MB            207.90 MB\n\n                       Unique chunks         Total chunks\nChunk index:                    2002                 3425\n------------------------------------------------------------------------------\n.ssh-080719-131709                   Mon, 2019-07-08 13:17:10 [8c03640c4d14b354639c3bd4778d53918ac6d54c05c8beb073fc8c75583ac401]\ntools-080719-131711                  Mon, 2019-07-08 13:17:11 [854837240e494ec06871cda3df6ed3a514da7b0abccd785121abeae31567d86e]\ncentminlogs-080719-131741            Mon, 2019-07-08 13:17:42 [51407a0630126fa66e04022020bf7e122478dec717fb965d41393956d467cf2d]\nconf-080719-131744                   Mon, 2019-07-08 13:17:45 [7cdcbd951dc099c2a4483f3c64163427c0c1288a0c93b8401d29441a74594801]\nconf.d-080719-131746                 Mon, 2019-07-08 13:17:46 [9d9bbd04f2514265b7317808a2104610da1d3f1f4fb9a1c1277fec9a11412f2e]\ncentminmod-080719-131747             Mon, 2019-07-08 13:17:48 [fe7b9ede09237873f7fd90bd516017b75345d55539dc70e2e963981ef836664f]\n```\n\nEnding output lists the borg repo names created\n\n```\n------------------------------------------------------------------------------\n.ssh-080719-131709                   Mon, 2019-07-08 13:17:10 [8c03640c4d14b354639c3bd4778d53918ac6d54c05c8beb073fc8c75583ac401]\ntools-080719-131711                  Mon, 2019-07-08 13:17:11 [854837240e494ec06871cda3df6ed3a514da7b0abccd785121abeae31567d86e]\ncentminlogs-080719-131741            Mon, 2019-07-08 13:17:42 [51407a0630126fa66e04022020bf7e122478dec717fb965d41393956d467cf2d]\nconf-080719-131744                   Mon, 2019-07-08 13:17:45 [7cdcbd951dc099c2a4483f3c64163427c0c1288a0c93b8401d29441a74594801]\nconf.d-080719-131746                 Mon, 2019-07-08 13:17:46 [9d9bbd04f2514265b7317808a2104610da1d3f1f4fb9a1c1277fec9a11412f2e]\ncentminmod-080719-131747             Mon, 2019-07-08 13:17:48 [fe7b9ede09237873f7fd90bd516017b75345d55539dc70e2e963981ef836664f]\n```\n\nGet borg repo info for repo name = `.ssh-080719-131709`\n\n```\nborg info ::.ssh-080719-131709\n```\n\n```\nborg info ::.ssh-080719-131709\nArchive name: .ssh-080719-131709\nArchive fingerprint: 8c03640c4d14b354639c3bd4778d53918ac6d54c05c8beb073fc8c75583ac401\nComment: .ssh\nHostname: test\nUsername: root\nTime (start): Mon, 2019-07-08 13:17:10\nTime (end): Mon, 2019-07-08 13:17:10\nDuration: 0.02 seconds\nNumber of files: 5\nCommand line: /usr/bin/borg create -e /home/nginx/domains/demodomain.com/log -e /home/nginx/domains/demodomain.com/backup --stats --comment .ssh --compression auto,zstd,6 ::.ssh-080719-131709 /root/.ssh\nUtilization of maximum supported archive size: 0%\n------------------------------------------------------------------------------\n                       Original size      Compressed size    Deduplicated size\nThis archive:                1.51 kB              1.38 kB              2.60 kB\nAll archives:              665.10 MB            218.53 MB            207.90 MB\n\n                       Unique chunks         Total chunks\nChunk index:                    2002                 3425\n```\n\n## borg list\n\nUsing [borg list](https://borgbackup.readthedocs.io/en/stable/usage/list.html) command you can list contents of a specific borg repo name\n\n```\nborg list\n.ssh-080719-131709                   Mon, 2019-07-08 13:17:10 [8c03640c4d14b354639c3bd4778d53918ac6d54c05c8beb073fc8c75583ac401]\ntools-080719-131711                  Mon, 2019-07-08 13:17:11 [854837240e494ec06871cda3df6ed3a514da7b0abccd785121abeae31567d86e]\ncentminlogs-080719-131741            Mon, 2019-07-08 13:17:42 [51407a0630126fa66e04022020bf7e122478dec717fb965d41393956d467cf2d]\nconf-080719-131744                   Mon, 2019-07-08 13:17:45 [7cdcbd951dc099c2a4483f3c64163427c0c1288a0c93b8401d29441a74594801]\nconf.d-080719-131746                 Mon, 2019-07-08 13:17:46 [9d9bbd04f2514265b7317808a2104610da1d3f1f4fb9a1c1277fec9a11412f2e]\ncentminmod-080719-131747             Mon, 2019-07-08 13:17:48 [fe7b9ede09237873f7fd90bd516017b75345d55539dc70e2e963981ef836664f]\n```\n\nlist contents of borg repo named = `conf.d-080719-131746`\n\n```\nborg list ::conf.d-080719-131746\ndrwxr-xr-x root   root          0 Sat, 2019-07-06 15:30:35 usr/local/nginx/conf/conf.d\n-rw-r--r-- root   root       1102 Tue, 2019-06-25 19:11:48 usr/local/nginx/conf/conf.d/demodomain.com.conf\n```\n\n## borg export-tar\n\nUsing [borg export-tar](https://borgbackup.readthedocs.io/en/stable/usage/tar.html) command you can export a specific borg repo back to tar format\n\n```\nborg list\n.ssh-080719-131709                   Mon, 2019-07-08 13:17:10 [8c03640c4d14b354639c3bd4778d53918ac6d54c05c8beb073fc8c75583ac401]\ntools-080719-131711                  Mon, 2019-07-08 13:17:11 [854837240e494ec06871cda3df6ed3a514da7b0abccd785121abeae31567d86e]\ncentminlogs-080719-131741            Mon, 2019-07-08 13:17:42 [51407a0630126fa66e04022020bf7e122478dec717fb965d41393956d467cf2d]\nconf-080719-131744                   Mon, 2019-07-08 13:17:45 [7cdcbd951dc099c2a4483f3c64163427c0c1288a0c93b8401d29441a74594801]\nconf.d-080719-131746                 Mon, 2019-07-08 13:17:46 [9d9bbd04f2514265b7317808a2104610da1d3f1f4fb9a1c1277fec9a11412f2e]\ncentminmod-080719-131747             Mon, 2019-07-08 13:17:48 [fe7b9ede09237873f7fd90bd516017b75345d55539dc70e2e963981ef836664f]\n```\n\nborg export-tar to a zstd compressed tar archive file the borg repo named = `conf.d-080719-131746` which contains your Centmin Mod Nginx Nginx vhost config files usually located at `/usr/local/nginx/conf/conf.d`\n\n```\nborg export-tar --tar-filter=\"zstd -6 --rsyncable\" /home/borgbackups::conf.d-080719-131746 conf.d-080719-131746.tar.zst\n```\n\nresulting zstd compressed tar archive `conf.d-080719-131746.tar.zst` listing\n```\nls -lahrt | grep conf.d\n-rw-------  1 root root 4.6K Jul  8 13:29 conf.d-080719-131746.tar.zst\n```\n\ntest inspection of zstd compressed tar archive without actually extracting contents\n\n```\ntar -I \"zstd -d\" -tvf  conf.d-080719-131746.tar.zst\n```\n\n```\ntar -I \"zstd -d\" -tvf  conf.d-080719-131746.tar.zst\ndrwxr-xr-x root/root         0 2019-07-06 15:30 usr/local/nginx/conf/conf.d/\n-rw-r--r-- root/root      1102 2019-06-25 19:11 usr/local/nginx/conf/conf.d/demodomain.com.conf\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentminmod%2Fcentminmod-borgbackups","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcentminmod%2Fcentminmod-borgbackups","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentminmod%2Fcentminmod-borgbackups/lists"}