{"id":31581188,"url":"https://github.com/koesan/auto-backup","last_synced_at":"2026-04-28T12:04:33.090Z","repository":{"id":316177311,"uuid":"1052501860","full_name":"koesan/Auto-Backup","owner":"koesan","description":"Automated daily backup solution with intelligent Google Drive integration, systemd timers, and seamless Linux system integration for enterprise-grade data protection.","archived":false,"fork":false,"pushed_at":"2025-09-23T04:33:18.000Z","size":27,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-05T21:57:02.047Z","etag":null,"topics":["automated-backup","backup-automation","bash","bash-script","cloud-backup","daily-backup","google-drive-api","linux","python","system-integration","systemd"],"latest_commit_sha":null,"homepage":"","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/koesan.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-08T06:30:35.000Z","updated_at":"2025-09-27T08:31:06.000Z","dependencies_parsed_at":"2025-09-23T06:31:56.041Z","dependency_job_id":null,"html_url":"https://github.com/koesan/Auto-Backup","commit_stats":null,"previous_names":["koesan/auto-backup"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/koesan/Auto-Backup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koesan%2FAuto-Backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koesan%2FAuto-Backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koesan%2FAuto-Backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koesan%2FAuto-Backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koesan","download_url":"https://codeload.github.com/koesan/Auto-Backup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koesan%2FAuto-Backup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32379632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T11:25:28.583Z","status":"ssl_error","status_checked_at":"2026-04-28T11:25:05.435Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["automated-backup","backup-automation","bash","bash-script","cloud-backup","daily-backup","google-drive-api","linux","python","system-integration","systemd"],"created_at":"2025-10-05T21:54:33.845Z","updated_at":"2026-04-28T12:04:33.082Z","avatar_url":"https://github.com/koesan.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auto Backup System\n\n\u003cdiv align=\"center\"\u003e\n\n[![Bash](https://img.shields.io/badge/Bash-4.0+-green.svg)](https://www.gnu.org/software/bash/)\n[![Python](https://img.shields.io/badge/Python-3.8+-blue.svg)](https://python.org)\n[![Google Drive API](https://img.shields.io/badge/Google%20Drive-API-yellow.svg)](https://developers.google.com/drive)\n[![Systemd](https://img.shields.io/badge/Systemd-Timer-red.svg)](https://systemd.io/)\n[![Platform](https://img.shields.io/badge/Platform-Linux-lightgrey.svg)](#)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n⚡ **Automated daily backup solution with intelligent Google Drive integration**\n\n---\n\n[🇬🇧 English](#english) | [🇹🇷 Türkçe](#türkçe)\n\n\u003c/div\u003e\n\n---\n\n## English\n\n## 🇬🇧\n\n### About This Project\n\nAuto Backup System is a comprehensive, enterprise-grade automated backup solution that seamlessly integrates with Google Drive. This intelligent system automatically creates daily archives of your important folders (Documents, Pictures) and uploads them to your designated Google Drive folder, ensuring your data is always protected without manual intervention.\n\nThe system combines the reliability of Linux systemd timers with the robust Google Drive API to create a \"set it and forget it\" backup solution. Once installed, it operates completely autonomously, creating timestamped archives and maintaining your specified retention policy while sending desktop notifications to keep you informed.\n\n### ✨ Key Features\n\n**🔄 Fully Automated Operation**\n- Daily automatic backups via systemd user timers\n- No manual intervention required after initial setup\n- Intelligent retry logic for failed uploads\n- Automatic cleanup of old backups based on retention policy\n\n**📁 Smart File Selection**\n- Automatically detects Documents and Pictures folders\n- Supports both English and Turkish folder names\n- Configurable inclusion/exclusion patterns\n- Preserves original folder structure in archives\n\n**📦 Advanced Archive Management**\n- Creates compressed .tar.zst archives for optimal storage efficiency\n- Timestamped archives with YYYY-MM-DD_HH-MM-SS format\n- Maintains specified number of recent backups automatically\n- Handles large files and directories efficiently\n\n**☁️ Seamless Google Drive Integration**\n- Secure service account authentication\n- Automatic upload progress tracking\n- Handles network interruptions gracefully\n- Maintains sync with cloud storage\n\n### 🏗️ System Architecture\n\n**Installation Components:**\n- `setup_backup.sh`: Intelligent installer script with user detection\n- `auto_backup.py`: Core backup engine with Google Drive integration\n- Systemd timer and service files for automated scheduling\n- Python virtual environment for dependency isolation\n\n**Security Model:**\n- User-level systemd services (no root daemon required)\n- Service account authentication with minimal permissions\n- Automatic credential file protection and validation\n- Secure API token management\n\n### 🛠️ Installation \u0026 Setup\n\n#### Prerequisites\n- **Linux System** with systemd support\n- **Python 3.8+** with pip and venv modules\n- **Google Cloud Platform account** for API access\n- **Sufficient disk space** for temporary archive creation\n\n#### Google Cloud Configuration\n\n**Step 1: Create Google Cloud Project**\n1. Visit [Google Cloud Console](https://console.cloud.google.com)\n2. Create a new project or select existing one\n3. Enable billing for the project\n\n**Step 2: Enable Google Drive API**\n1. Navigate to **APIs \u0026 Services → Library**\n2. Search for \"Google Drive API\" and enable it\n\n**Step 3: Create Service Account**\n1. Go to **APIs \u0026 Services → Credentials**\n2. Click **Create Credentials → Service Account**\n3. Provide descriptive name and click **Done**\n\n**Step 4: Generate JSON Key**\n1. Click **Actions (⋮) → Manage keys** on service account row\n2. Select **Add Key → Create new key → JSON**\n3. Download the JSON file securely\n\n**Step 5: Setup Drive Folder**\n1. Create backup folder in [Google Drive](https://drive.google.com/)\n2. Share folder with service account email (Editor permissions)\n3. Copy folder ID from URL (part after `/folders/`)\n\n#### Quick Installation\n\n**Step 1: Clone Repository**\n```bash\ngit clone https://github.com/koesan/Auto-Backup.git\ncd Auto-Backup\n```\n\n**Step 2: Place Service Account Key**\nPlace your downloaded `.json` service account file in the same directory as `setup_backup.sh`.\n\n**Step 3: Run Installer**\n```bash\nchmod +x setup_backup.sh\nsudo ./setup_backup.sh --folderID YOUR_DRIVE_FOLDER_ID\n```\n\nThe installer automatically:\n- Detects the user who ran sudo (via SUDO_USER)\n- Creates `~/Backup/` directory structure\n- Sets up Python virtual environment with dependencies\n- Copies and secures service account JSON file\n- Creates systemd user timer and service\n- Enables user session persistence (loginctl enable-linger)\n- Starts the backup timer immediately\n\n#### Manual Testing\n```bash\n# Test backup script directly\nsudo -u yourusername ~/Backup/venv/bin/python3 ~/Backup/auto_backup.py\n\n# Check timer status\nsudo -u yourusername systemctl --user status drive-backup.timer drive-backup.service\n```\n\n### ⚙️ Configuration Options\n\n**Backup Retention:** Edit `~/Backup/auto_backup.py` to modify how many backups to keep (default: keeps last N backups).\n\n**Backup Frequency:** Modify systemd timer file to change backup schedule (default: daily at a random time).\n\n**Folder Selection:** Customize which folders to backup by editing the folder detection logic in the Python script.\n\n**Archive Format:** Switch between compression formats (tar.zst, tar.gz, zip) based on your needs.\n\n### 📊 Monitoring \u0026 Maintenance\n\n**Log Files:**\n- Systemd service logs: `journalctl --user -u drive-backup.service`\n- Application logs: Check console output during manual runs\n\n**Status Monitoring:**\n```bash\n# Check timer schedule\nsystemctl --user list-timers drive-backup.timer\n\n# View recent backup activity  \njournalctl --user -u drive-backup.service --since \"7 days ago\"\n```\n\n**Troubleshooting Common Issues:**\n- **Authentication failures**: Verify service account permissions and JSON file access\n- **Upload errors**: Check network connectivity and Drive folder accessibility\n- **Missing notifications**: Ensure user-level systemd service is running\n- **Timer not triggering**: Verify loginctl linger is enabled for the user\n\n### 🔧 Advanced Configuration\n\n**Custom Backup Directories:**\nModify the folder detection logic in `auto_backup.py` to include additional directories beyond Documents and Pictures.\n\n**Notification Customization:**\nAdjust notification content and timing by modifying the `notify-send` calls in the backup script.\n\n**Network Optimization:**\nConfigure retry intervals and timeout values for different network conditions.\n\n### 🚀 Integration with google_drive_yedek\n\nThis project is designed to work seamlessly with the [google_drive_yedek](https://github.com/koesan/google_drive_yedek) repository, providing additional manual management capabilities:\n\n- Manual backup operations\n- Detailed file listing and management\n- Advanced download and synchronization options\n- Extended Google Drive API functionality\n\n---\n\n## Türkçe\n\n## 🇹🇷\n\n### Proje Hakkında\n\nAuto Backup System, Google Drive ile sorunsuz entegrasyon sağlayan kapsamlı, kurumsal seviye otomatik yedekleme çözümüdür. Bu akıllı sistem, önemli klasörlerinizin (Belgeler, Resimler) günlük arşivlerini otomatik olarak oluşturur ve belirlediğiniz Google Drive klasörüne yükler, verilerinizin manuel müdahale olmadan her zaman korunmasını sağlar.\n\nSistem, Linux systemd timer'larının güvenilirliğini güçlü Google Drive API'si ile birleştirerek \"kur ve unut\" yedekleme çözümü oluşturur. Kurulduktan sonra tamamen özerk olarak çalışır, zaman damgalı arşivler oluşturur ve belirttiğiniz saklama politikasını korurken sizi bilgilendirmek için masaüstü bildirimleri gönderir.\n\n### ✨ Temel Özellikler\n\n**🔄 Tamamen Otomatik İşlem**\n- Systemd kullanıcı timer'ları ile günlük otomatik yedeklemeler\n- İlk kurulumdan sonra manuel müdahale gerektirmez\n- Başarısız yüklemeler için akıllı yeniden deneme mantığı\n- Saklama politikasına göre eski yedeklerin otomatik temizliği\n\n**📁 Akıllı Dosya Seçimi**\n- Belgeler ve Resimler klasörlerini otomatik algılar\n- Hem İngilizce hem Türkçe klasör adlarını destekler\n- Yapılandırılabilir dahil etme/hariç tutma kalıpları\n- Arşivlerde orijinal klasör yapısını korur\n\n**📦 Gelişmiş Arşiv Yönetimi**\n- Optimal depolama verimliliği için sıkıştırılmış .tar.zst arşivleri oluşturur\n- YYYY-MM-DD_HH-MM-SS formatında zaman damgalı arşivler\n- Belirtilen sayıda son yedeği otomatik olarak korur\n- Büyük dosya ve dizinleri verimli bir şekilde işler\n\n**☁️ Sorunsuz Google Drive Entegrasyonu**\n- Güvenli servis hesabı kimlik doğrulaması\n- Otomatik yükleme ilerleme takibi\n- Ağ kesintilerini zarif bir şekilde işler\n- Bulut depolama ile senkronizasyonu korur\n\n### 🏗️ Sistem Mimarisi\n\n**Kurulum Bileşenleri:**\n- `setup_backup.sh`: Kullanıcı algılama ile akıllı kurulum scripti\n- `auto_backup.py`: Google Drive entegrasyonu ile temel yedekleme motoru\n- Otomatik zamanlama için systemd timer ve servis dosyaları\n- Bağımlılık izolasyonu için Python sanal ortamı\n\n**Güvenlik Modeli:**\n- Kullanıcı seviyesi systemd servisleri (root daemon gerekmiyor)\n- Minimal izinlerle servis hesabı kimlik doğrulaması\n- Otomatik kimlik bilgisi dosya koruması ve doğrulaması\n- Güvenli API token yönetimi\n\n### 🛠️ Kurulum ve Ayarlar\n\n#### Ön Gereksinimler\n- **Linux Sistemi** systemd desteği ile\n- **Python 3.8+** pip ve venv modülleri ile\n- **Google Cloud Platform hesabı** API erişimi için\n- **Yeterli disk alanı** geçici arşiv oluşturma için\n\n#### Google Cloud Yapılandırması\n\n**Adım 1: Google Cloud Projesi Oluşturma**\n1. [Google Cloud Console](https://console.cloud.google.com)'u ziyaret edin\n2. Yeni proje oluşturun veya mevcudu seçin\n3. Proje için faturalamayı etkinleştirin\n\n**Adım 2: Google Drive API'yi Etkinleştirme**\n1. **APIs \u0026 Services → Library**'ye gidin\n2. \"Google Drive API\" aratın ve etkinleştirin\n\n**Adım 3: Servis Hesabı Oluşturma**\n1. **APIs \u0026 Services → Credentials**'a gidin\n2. **Create Credentials → Service Account**'a tıklayın\n3. Açıklayıcı isim verin ve **Done**'a tıklayın\n\n**Adım 4: JSON Anahtarı Üretme**\n1. Servis hesabı satırında **Actions (⋮) → Manage keys**'e tıklayın\n2. **Add Key → Create new key → JSON**'ı seçin\n3. JSON dosyasını güvenli bir şekilde indirin\n\n**Adım 5: Drive Klasörü Kurulumu**\n1. [Google Drive](https://drive.google.com/)'da yedek klasörü oluşturun\n2. Klasörü servis hesabı e-postası ile paylaşın (Düzenleyici izinleri)\n3. URL'den klasör ID'sini kopyalayın (`/folders/` sonrası kısım)\n\n#### Hızlı Kurulum\n\n**Adım 1: Depoyu Klonlama**\n```bash\ngit clone https://github.com/koesan/Auto-Backup.git\ncd Auto-Backup\n```\n\n**Adım 2: Servis Hesabı Anahtarını Yerleştirme**\nİndirdiğiniz `.json` servis hesabı dosyasını `setup_backup.sh` ile aynı dizine yerleştirin.\n\n**Adım 3: Kurulumu Çalıştırma**\n```bash\nchmod +x setup_backup.sh\nsudo ./setup_backup.sh --folderID GOOGLE_DRIVE_KLASOR_ID\n```\n\nKurulum otomatik olarak:\n- Sudo çalıştıran kullanıcıyı algılar (SUDO_USER üzerinden)\n- `~/Backup/` dizin yapısını oluşturur\n- Bağımlılıklarla Python sanal ortamı kurar\n- Servis hesabı JSON dosyasını kopyalar ve güvene alır\n- Systemd kullanıcı timer'ı ve servisi oluşturur\n- Kullanıcı oturum kalıcılığını etkinleştirir (loginctl enable-linger)\n- Yedekleme timer'ını hemen başlatır\n\n#### Manuel Test\n```bash\n# Yedekleme scriptini doğrudan test et\nsudo -u kullaniciadi ~/Backup/venv/bin/python3 ~/Backup/auto_backup.py\n\n# Timer durumunu kontrol et\nsudo -u kullaniciadi systemctl --user status drive-backup.timer drive-backup.service\n```\n\n### ⚙️ Yapılandırma Seçenekleri\n\n**Yedek Saklama:** Kaç yedek tutacağınızı değiştirmek için `~/Backup/auto_backup.py`'yi düzenleyin (varsayılan: son N yedeği tutar).\n\n**Yedekleme Sıklığı:** Yedekleme zamanlamasını değiştirmek için systemd timer dosyasını değiştirin (varsayılan: rastgele zamanda günlük).\n\n**Klasör Seçimi:** Python scriptindeki klasör algılama mantığını düzenleyerek hangi klasörlerin yedekleneceğini özelleştirin.\n\n**Arşiv Formatı:** İhtiyaçlarınıza göre sıkıştırma formatları (tar.zst, tar.gz, zip) arasında geçiş yapın.\n\n### 📊 İzleme ve Bakım\n\n**Günlük Dosyaları:**\n- Systemd servis günlükleri: `journalctl --user -u drive-backup.service`\n- Uygulama günlükleri: Manuel çalıştırmalar sırasında konsol çıktısını kontrol edin\n\n**Durum İzleme:**\n```bash\n# Timer zamanlamasını kontrol et\nsystemctl --user list-timers drive-backup.timer\n\n# Son yedekleme aktivitesini görüntüle\njournalctl --user -u drive-backup.service --since \"7 days ago\"\n```\n\n**Yaygın Sorunları Giderme:**\n- **Kimlik doğrulama hataları**: Servis hesabı izinlerini ve JSON dosya erişimini doğrulayın\n- **Yükleme hataları**: Ağ bağlantısını ve Drive klasör erişilebilirliğini kontrol edin\n- **Eksik bildirimler**: Kullanıcı seviyesi systemd servisinin çalıştığından emin olun\n- **Timer tetiklenmiyor**: Kullanıcı için loginctl linger'ın etkin olduğunu doğrulayın\n\n### 🔧 Gelişmiş Yapılandırma\n\n**Özel Yedekleme Dizinleri:**\nBelgeler ve Resimler'in ötesinde ek dizinleri dahil etmek için `auto_backup.py`'deki klasör algılama mantığını değiştirin.\n\n**Bildirim Özelleştirme:**\nYedekleme scriptindeki `notify-send` çağrılarını değiştirerek bildirim içeriğini ve zamanlamasını ayarlayın.\n\n**Ağ Optimizasyonu:**\nFarklı ağ koşulları için yeniden deneme aralıklarını ve zaman aşımı değerlerini yapılandırın.\n\n### 🚀 google_drive_yedek ile Entegrasyon\n\nBu proje, ek manuel yönetim yetenekleri sağlayan [google_drive_yedek](https://github.com/koesan/google_drive_yedek) deposu ile sorunsuz çalışacak şekilde tasarlanmıştır:\n\n- Manuel yedekleme işlemleri\n- Detaylı dosya listeleme ve yönetimi\n- Gelişmiş indirme ve senkronizasyon seçenekleri\n- Genişletilmiş Google Drive API işlevselliği\n\n---\n\n### 📄 License\n\nThis project is open source and available under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoesan%2Fauto-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoesan%2Fauto-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoesan%2Fauto-backup/lists"}