{"id":29953766,"url":"https://github.com/bocaletto-luca/backup-linux","last_synced_at":"2025-08-21T02:06:07.684Z","repository":{"id":302282735,"uuid":"1011857997","full_name":"bocaletto-luca/Backup-Linux","owner":"bocaletto-luca","description":"Backup for Linux is an interactive, single-file CLI backup utility for Linux. It captures incremental snapshots, compresses changed files into tar.gz (or pigz), encrypts them with GPG, verifies integrity via SHA256, and auto-rotates old backups. A menu-driven interface simplifies configuration and restore. By Bocaletto Luca","archived":false,"fork":false,"pushed_at":"2025-07-06T00:38:00.000Z","size":87,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-03T15:23:30.064Z","etag":null,"topics":["admin","backup","bocaletto-luca","checksum","cli","debian","encryption","english","incremental-backups","interactive","italian","linux","opensource","rotates","snapshots","system","terminal","tool","utility"],"latest_commit_sha":null,"homepage":"https://bocaletto-luca.github.io/","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/bocaletto-luca.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-07-01T12:47:08.000Z","updated_at":"2025-07-06T00:38:03.000Z","dependencies_parsed_at":"2025-07-01T14:52:18.166Z","dependency_job_id":null,"html_url":"https://github.com/bocaletto-luca/Backup-Linux","commit_stats":null,"previous_names":["bocaletto-luca/backup-linux"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bocaletto-luca/Backup-Linux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bocaletto-luca%2FBackup-Linux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bocaletto-luca%2FBackup-Linux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bocaletto-luca%2FBackup-Linux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bocaletto-luca%2FBackup-Linux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bocaletto-luca","download_url":"https://codeload.github.com/bocaletto-luca/Backup-Linux/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bocaletto-luca%2FBackup-Linux/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271415496,"owners_count":24755639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["admin","backup","bocaletto-luca","checksum","cli","debian","encryption","english","incremental-backups","interactive","italian","linux","opensource","rotates","snapshots","system","terminal","tool","utility"],"created_at":"2025-08-03T15:11:16.417Z","updated_at":"2025-08-21T02:06:07.649Z","avatar_url":"https://github.com/bocaletto-luca.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyBackup\n### Auto Backup for Linux | Python | Opensource\n#### Author: Bocaletto Luca\n\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue?style=for-the-badge\u0026logo=gnu)](LICENSE) [![Language: Python](https://img.shields.io/badge/Language-Python-blue?style=for-the-badge\u0026logo=python)](https://www.python.org/) [![Linux-Compatible](https://img.shields.io/badge/Linux-Compatible-blue?style=for-the-badge\u0026logo=linux)](https://www.kernel.org/) [![Status: Complete](https://img.shields.io/badge/Status-Complete-brightgreen?style=for-the-badge)](https://github.com/bocaletto-luca/Directory-Monitor)\n\nInteractive, single-file incremental backup tool with encryption, checksums, retention and restore—all in your terminal.\n\nbackup_main.py is an interactive, single-file CLI backup utility for Linux. It captures incremental snapshots, compresses changed files into tar.gz (or pigz), encrypts them with GPG, verifies integrity via SHA256, and auto-rotates old backups. A menu-driven interface simplifies configuration and restore.\n\n#### Language: English, Italian.\n\n[![Source Code](https://img.shields.io/badge/Source%20Code-GitHub-blue?logo=github)](https://github.com/bocaletto-luca/Backup-Linux)\n\n---\n\n## Table of Contents\n\n1. [Overview](#overview)  \n2. [Features](#features)  \n3. [Prerequisites](#prerequisites)  \n4. [Installation](#installation)  \n5. [Configuration](#configuration)  \n6. [Usage](#usage)  \n   - [Run Backup](#run-backup)  \n   - [Restore Archive](#restore-archive)  \n7. [Exclude Patterns](#exclude-patterns)  \n8. [Logging](#logging)  \n9. [Email Notifications](#email-notifications)  \n10. [.backupignore Support](#backupignore-support)  \n11. [Contributing](#contributing)  \n12. [License](#license)  \n13. [Author](#author)  \n\n---\n\n## Overview\n\n`backup_main.py` is an all-in-one, interactive CLI utility for Linux (Debian/Ubuntu). It provides:\n\n- Incremental backups based on file modification times  \n- Compressed archives (`.tar.gz`) or parallel compression with `pigz`  \n- GPG encryption of archives  \n- SHA256 checksums for integrity verification  \n- Automatic retention (rotation) of old backups  \n- Interactive restore of encrypted backups  \n- Persistent configuration stored in `~/.config/backup_main/config.json`  \n- Exclude patterns and `.backupignore` support  \n- Console and rotating file logging  \n- Optional email notifications on success or failure  \n\nEverything runs from a simple menu—no separate modules, just one file!\n\n---\n\n## Features\n\n- **Interactive Menu**: Configure, run backup and restore without memorizing flags  \n- **Persistent Config**: Your settings saved in `~/.config/backup_main/config.json`  \n- **Incremental Snapshots**: Only changed or new files are archived  \n- **Compression Options**: Native `tar.gz` or faster `pigz` if installed  \n- **GPG Encryption**: Secure archives with your GPG key  \n- **Checksums**: SHA256 record saved alongside each `.gpg` file  \n- **Retention**: Automatically delete backups older than configured days  \n- **Restore**: List and decrypt any backup to a target folder  \n- **Exclude Patterns**: Filter out files or directories by glob pattern  \n- **.backupignore**: Place patterns in source dir for project-specific ignores  \n- **Logging**: Combines console output with daily rotating log files  \n- **Email Alerts**: SMTP notifications for success or failure  \n\n---\n\n## Prerequisites\n\n- Python 3.8+  \n- GPG (`gnupg`) command-line tool  \n- (Optional) `pigz` for parallel compression  \n- An existing GPG key pair (public key on the machine for encryption)  \n- SMTP server credentials if you want email notifications  \n\n---\n\n## Installation\n\n1. Clone the repo  \n   ```bash\n   git clone https://github.com/bocaletto-luca/backup_main.py.git\n   cd backup_main.py\n   ```  \n2. Install the Python dependency  \n   ```bash\n   pip install python-gnupg\n   ```  \n3. Make the script executable  \n   ```bash\n   chmod +x backup_main.py\n   ```  \n\n---\n\n## Configuration\n\n1. Launch the script  \n   ```bash\n   ./backup_main.py\n   ```  \n2. Select **1) Configure settings**  \n3. Enter:\n\n   - **Source directory** (e.g. `/home/user/projects`)  \n   - **Backup directory** (e.g. `~/backups`)  \n   - **GPG key ID** (the public key for encryption)  \n   - **Retention days** (how long to keep `.gpg` backups)  \n   - **Exclude patterns** (comma-separated globs)  \n   - **Log level** (`DEBUG`, `INFO`, `WARN`)  \n   - **SMTP settings** (server, port, username, password, from/to)  \n4. The tool saves all settings to `~/.config/backup_main/config.json`.\n\n---\n\n## Usage\n\n### Run Backup\n\nFrom the menu, choose **2) Run backup**.  \nThe script will:\n\n1. Load your config and verify paths/GPG key  \n2. Scan source dir and load previous snapshot  \n3. Archive only changed files to `bkp_\u003ctimestamp\u003e.tar.gz`  \n4. Encrypt archive to `bkp_\u003ctimestamp\u003e.tar.gz.gpg`  \n5. Generate `bkp_\u003ctimestamp\u003e.tar.gz.gpg.sha256`  \n6. Delete old backups beyond retention  \n7. Log actions and send optional email  \n\n### Restore Archive\n\nFrom the menu, choose **3) Restore archive**.  \nYou will see a numbered list of encrypted backups.  \nSelect one, then specify a restore folder.  \nThe script will:\n\n1. Decrypt to a temporary `.tar.gz`  \n2. Extract contents into your target directory  \n3. Clean up temporary files  \n\n---\n\n## Exclude Patterns\n\nYou can filter out files or directories by glob pattern. Examples:\n\n- `*.tmp`  \n- `cache/*`  \n- `**/*.log`  \n\nEnter patterns in the configuration step (comma-separated).  \nAdditionally, place a `.backupignore` file in your source directory to version-control ignore rules.\n\n---\n\n## Logging\n\n- **Console**: real-time INFO/WARN/DEBUG messages  \n- **File**: `backup.log` in your backup directory, rotated daily  \n- **Backup count**: log files retained based on your retention setting  \n\n---\n\n## Email Notifications\n\nOn each backup run (success or failure), you can send an email alert:\n\n- **SMTP server** and credentials in config  \n- **From** and **To** addresses  \n- **Subject** indicates `[OK]` or `[FAIL]` plus timestamp  \n\n---\n\n## .backupignore Support\n\nCreate a file named `.backupignore` in your source directory:\n\n```text\n# ignore temp files\n*.tmp\n# ignore cache folder\ncache/\n```\n\nThese patterns are merged with your global exclude list.\n\n---\n\n## Contributing\n\nContributions are welcome! Please:\n\n1. Fork the repository  \n2. Create a feature branch  \n3. Commit and push your changes  \n4. Open a Pull Request  \n\nFor major changes, open an issue first to discuss.\n\n---\n\n## License\n\nThis project is licensed under the [GPL License](LICENSE).\n\n---\n\n## Author\n\n**Luca Bocaletto** ([@bocaletto-luca](https://github.com/bocaletto-luca))  \nInteractive backup enthusiast, Python developer.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbocaletto-luca%2Fbackup-linux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbocaletto-luca%2Fbackup-linux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbocaletto-luca%2Fbackup-linux/lists"}