{"id":26275321,"url":"https://github.com/smtws/auto-pi-backup","last_synced_at":"2026-05-18T00:02:22.204Z","repository":{"id":282377680,"uuid":"948386575","full_name":"smtws/auto-pi-backup","owner":"smtws","description":"small script to automate backing up a raspberry pis filesystem to a nas mount","archived":false,"fork":false,"pushed_at":"2025-03-20T07:23:05.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T07:32:00.274Z","etag":null,"topics":["backup","raspberry-pi","shell-scripts"],"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/smtws.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-14T08:46:32.000Z","updated_at":"2025-03-20T07:23:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"4dd94175-13f1-4e4d-ad8c-49879d9ba622","html_url":"https://github.com/smtws/auto-pi-backup","commit_stats":null,"previous_names":["smtws/auto-pi-backup"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/smtws/auto-pi-backup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smtws%2Fauto-pi-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smtws%2Fauto-pi-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smtws%2Fauto-pi-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smtws%2Fauto-pi-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smtws","download_url":"https://codeload.github.com/smtws/auto-pi-backup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smtws%2Fauto-pi-backup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33160167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"ssl_error","status_checked_at":"2026-05-17T22:39:10.741Z","response_time":107,"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","raspberry-pi","shell-scripts"],"created_at":"2025-03-14T10:15:23.705Z","updated_at":"2026-05-18T00:02:22.199Z","avatar_url":"https://github.com/smtws.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auto Pi Backup\n\n**Small script to automate backing up a Raspberry Pi's filesystem to a NAS mount.**\n\n---\n\n## Overview\nThis script automates the process of backing up a Raspberry Pi's filesystem to a NAS mount. It uses `image-backup` from the [RonR-RPi-image-utils](https://github.com/seamusdemora/RonR-RPi-image-utils) repository to create incremental and full backups. The script also includes features like automatic cleanup of old backups and handling of NAS mount/unmount operations.\n\n---\n\n## Key Features\n- **Incremental Backups**: Uses `image-backup` to only back up changes since the last backup, saving time and storage.\n- **Automatic Cleanup**: Deletes backups older than 4 weeks to free up space.\n- **Full Backup Every Week**: Creates a full backup every 7 days for redundancy.\n- **Auto Mount/Unmount**: Automatically mounts the NAS share before backup and unmounts it afterward.\n- **Cron Job Integration**: Designed to run as a daily cron job for hands-free operation.\n\n---\n\n## Setup\n\n### 1. Clone the Repository\n```bash\ngit clone https://github.com/smtws/auto-pi-backup.git\ncd auto-pi-backup\n```\n\n### 2. Install `image-backup`\nThis script relies on `image-backup` from the [RonR-RPi-image-utils](https://github.com/seamusdemora/RonR-RPi-image-utils) repository. Install it by following the instructions in the repository.\n\n### 3. Configure the Script\nEdit the script (`backup.sh`) and update the following variables at the top of the file:\n\n```bash\n# Configuration\nNAS_MOUNT=\"/mnt/backup\"  # Local mount point for the NAS\nNAS_SHARE=\"YOUR_NAS_IP:/path/to/your/share\"  # NAS IP and share path\n```\n\n### 4. Make the Script Executable and move it, and clean up\nRun the following command to make the script executable:\n```bash\nchmod +x backup.sh\nchown root:root backup.sh\nsudo mv backup.sh /usr/sbin/backup.sh\ncd ..\nrm -rf auto-pi-backup\n```\n\n### 5. Set Up Cron Job\nAdd a daily cron job to run the script automatically. Edit the crontab:\n\n```bash\nsudo crontab -e\n```\n\nAdd the following line to run the script daily at 2 AM:\n\n```bash\n0 2 * * * /usr/sbin/backup.sh\n```\n\n### 5. Test the Script\nRun the script manually to ensure everything works:\n\n```bash\nsudo /usr/sbin/backup.sh\n```\n#### Do not interrupt it, it will take several minutes and it does NOT handle SIGTERM or SIGKILL gracefully \n\nCheck the log file (`/var/log/backup.log`) for any errors or issues.\n\n---\n\n## How It Works\n1. **Mount NAS**: The script mounts the NAS share to the specified mount point.\n2. **Check Backup Age**: If the last backup is older than 7 days, it renames the old backup and creates a new full backup.\n3. **Incremental Backup**: If a backup already exists, the script uses `image-backup` to perform an incremental backup.\n4. **Cleanup**: Backups older than 4 weeks are automatically deleted.\n5. **Unmount NAS**: After the backup completes, the script unmounts the NAS share.\n\n---\n\n## Dependencies\n- **`image-backup`**: This script relies on `image-backup` from the [RonR-RPi-image-utils](https://github.com/seamusdemora/RonR-RPi-image-utils) repository. Make sure to install it before using this script.\n\n---\n\n## License\nThis project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.\n\n---\n\n## Disclaimer\nThis script is provided **\"as-is,\" without any warranties or guarantees** of any kind, either express or implied. The author disclaims all liability for any damages, losses, or issues arising from the use of this script. Use at your own risk.\n\n---\n\n## Contributing\nContributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.\n\n---\n\n## Support\nIf you find this script useful, consider giving it a ⭐ on GitHub! For questions or issues, please open an issue in the repository.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmtws%2Fauto-pi-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmtws%2Fauto-pi-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmtws%2Fauto-pi-backup/lists"}