{"id":47356666,"url":"https://github.com/psitem/edgerouter-backup","last_synced_at":"2026-04-01T07:00:57.804Z","repository":{"id":47921775,"uuid":"95153261","full_name":"psitem/edgerouter-backup","owner":"psitem","description":"EdgeRouter to git repo backup scripts.","archived":false,"fork":false,"pushed_at":"2023-03-08T21:33:34.000Z","size":34,"stargazers_count":67,"open_issues_count":0,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2023-10-19T23:11:39.931Z","etag":null,"topics":["backup","edgeos","edgerouter","ubiquiti"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/psitem.png","metadata":{"files":{"readme":"README.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}},"created_at":"2017-06-22T20:20:32.000Z","updated_at":"2023-10-20T00:59:53.514Z","dependencies_parsed_at":"2022-08-12T14:20:09.375Z","dependency_job_id":"8d151c3b-c043-4ba9-8c4e-2d60a62acc9d","html_url":"https://github.com/psitem/edgerouter-backup","commit_stats":null,"previous_names":["tbyehl/edgerouter-backup"],"tags_count":8,"template":null,"template_full_name":null,"purl":"pkg:github/psitem/edgerouter-backup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psitem%2Fedgerouter-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psitem%2Fedgerouter-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psitem%2Fedgerouter-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psitem%2Fedgerouter-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psitem","download_url":"https://codeload.github.com/psitem/edgerouter-backup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psitem%2Fedgerouter-backup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31269194,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T06:57:45.811Z","status":"ssl_error","status_checked_at":"2026-04-01T06:57:42.389Z","response_time":53,"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":["backup","edgeos","edgerouter","ubiquiti"],"created_at":"2026-03-18T03:00:18.694Z","updated_at":"2026-04-01T07:00:57.792Z","avatar_url":"https://github.com/psitem.png","language":"Shell","funding_links":[],"categories":["Backup Tools"],"sub_categories":["Other Platforms"],"readme":"# edgerouter-backup\n\nUbiquiti's EdgeOS provides `system config-management commit-archive location` as a way to push configuration commits to a remote location. For my use, I have two problems with it:\n\n1. Backups are in their brace-y format instead of CLI commands.\n2. They use a unique filename for each commit. \n\nI want to put my configuration files into source control, so maintaining the same filename is preferable. I also find the CLI format to be easier to read and `diff` against.\n\nThis backup script hooks into the EdgeRouter `commit` process and generates configuration files in both CLI and brace-y formats, along with a full configuration backup in `.tar.gz` form that is directly restore-able via the management GUI. The files are then sent to a remote server via `scp`, and `git commit` \u0026 `git push` are run on the remote server -- avoiding having to install `git` on the EdgeRouter itself. This script can be used along side `config-management` or as a replacement.\n\nThese scripts do not modify any EdgeOS-provided files. The locations of all the files will survive reboots and firmware upgrades. I've personally tested this on an ER-8 and ER-X-SFP running v1.9.1.1 firmware and verified firmware survivability by upgrading to v1.9.1.1unms. Should work on any EdgeRouter model. Might work on the USG / USG Pro but that's rather pointless -- back up your UniFi Controller.\n\n\n### **IMPORTANT**\n\nThese configuration dumps **ARE NOT SANITIZED**. They may contain plaintext passwords for some services. **Do not publish to a publicly accessible git repo.**\n\n---\n\n* [Installation](#installation)\n* [EdgeRouter Configuration](#edgerouter-configuration)\n* [Remote Host Configuration](#remote-host-configuration)\n* [Caveats](#caveats)\n* [Alternatives](#alternatives)\n\n---\n\n### Installation\n\nCopy contents of `config` directory to `/config` on EdgeRouter.\n\n\n### EdgeRouter Configuration\n\nEdit `/config/user-data/edgerouter-backup.conf` with your information:\n\n     #!/bin/bash\n     \n     # Default commit message\n     DEFAULT_COMMIT_MESSAGE=\"Auto commit by edgerouter-backup\"\n\n     # Path to private key for SSH / SCP\n     SSH_KEYFILE=/config/user-data/backup_user_private.key\n     SSH_USER=username\n     SSH_HOST=host\n     SSH_PORT=port\n     \n     # Path to git repo on SSH_HOST\n     REPO_PATH=\\~/edgerouter-backups\n\n     # Names for EdgeRouter configuration backup files. If you are backing\n     # up multiple EdgeRouters to the same place you'll want to ensure that\n     # FNAME_BASE is unique to each EdgeRouter\n     FNAME_BASE=$HOSTNAME\n     \n     FNAME_CONFIG=$FNAME_BASE.config.conf\n     FNAME_CLI=$FNAME_BASE.commands.conf\n     FNAME_BACKUP=$FNAME_BASE.backup.tar.gz\n\nEdit the `SSH_KEYFILE` file to have the private key for `SSH_USER`\n\n`sudo chmod +x /config/scripts/post-config.d/*.sh \u0026\u0026 sudo /config/scripts/post-config.d/hooks.sh \u0026\u0026 sudo /config/scripts/post-config.d/ssh_keys.sh`\n\n\t \n### Remote Host Configuration\n\n* Make sure your SSH key works for `SSH_USER` (ie: place public key in `~/.ssh/authorized_users`)\n* Create git repo in `REPO_PATH`.\n* Configure git settings for repo as desired.\n* Verify that `git commit -m \"Commit Message\"` and `git push` execute without interaction.\n\n\n### Caveats\n\nThere's no error-handling in these scripts at all. \n\nIf your `SSH_HOST` is unreachable, the config file won't get pushed and it will not try again. If you're making changes from the command line you will see the errors and can run `sudo /config/user-data/hooks/03-edgerouter-backup.sh` manually to try again.\n\nYou could also set up a cron job to perform the push periodically:\n\n     set system task-scheduler task commit-push executable path /config/user-data/hooks/03-edgerouter-backup.sh\n     set system task-scheduler task commit-push interval 1h\n\n`git` is smart enough not to `commit` or `push` when no actual changes have been made, however, this script is not -- the backups will be generated and transferred every time `03-edgerouter-backup.sh` runs.\n\n\n### Alternatives\n\nIf you have many EdgeRouters, a proper network configuration management system such as [RANCID](http://www.shrubbery.net/rancid/) or [Oxidized](https://github.com/ytti/oxidized) may be more appropriate.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsitem%2Fedgerouter-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsitem%2Fedgerouter-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsitem%2Fedgerouter-backup/lists"}