Skip to content

cybalp/Hygiene-Core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hygiene-Core

Arch Linux Python Systemd
License Open Source
Telegram

Hygiene-Core Banner

🇺🇸 EN | 🇹🇷 TR

🇺🇸 EN

⚙️ System Architecture

graph LR
    subgraph Automation
        T[Systemd Timer] --> S[Systemd Service]
    end
    subgraph Core Engine
        S --> O[Orchestrator]
        O --> M1[Cache Cleaner]
        O --> M2[Custom Modules...]
    end
    subgraph Reporting
        M1 & M2 --> R[Result Parser]
        R --> TL[Telegram Bot]
    end
Loading

Hygiene-Core is a modular, lightweight maintenance engine designed for Arch Linux. It automates manual cleanup tasks, optimizes system storage, and sends aesthetic reports via Telegram.

Telegram Report Example

✨ Features

  • Modular Design: Each task is an independent plugin in modules/.
  • Telegram Integration: Instant reporting of cleaned space.
  • Safety First: Includes Dry Run mode and lsof checks to protect active files.
  • Idle Execution: Runs via Systemd with idle priority to ensure zero UX impact.

🛡️ Dry Run Mode

By default, Hygiene-Core is shipped with dry_run: true in config.yaml. In this mode, the engine will scan the system, calculate the potential clean up size, and send the Telegram report, but it will not permanently delete any files. To execute the actual cleanup process, edit the configuration:

# config.yaml
dry_run: false

🚀 Quick Start

git clone [https://github.com/cybalp/Hygiene-Core](https://github.com/cybalp/Hygiene-Core)
cd Hygiene-Core
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
cp .env-example .env # Add your Telegram credentials

⏰ Automating with Systemd (Optional)

To run Hygiene-Core fully automatically on a schedule (e.g., every Monday at 00:00) and grant it the necessary permissions for system-level cleanups:

  1. Grant passwordless sudo for specific commands: To allow the script to clean Arch Linux cache via pacman and journalctl, run this in your terminal:
echo "$USER ALL=(root) NOPASSWD: /usr/bin/pacman -Sc --noconfirm, /usr/bin/pacman -Rns --noconfirm *, /usr/bin/journalctl --vacuum-size=*, /usr/bin/journalctl --vacuum-time=*" | sudo tee /etc/sudoers.d/hygiene-core > /dev/null && sudo chmod 0440 /etc/sudoers.d/hygiene-core && sudo visudo -c
  1. Create the Systemd User Service: Create ~/.config/systemd/user/hygiene.service:
[Unit]
Description=Hygiene-Core Maintenance Task
After=network-online.target

[Service]
Type=oneshot
WorkingDirectory=%h/SCRIPTS/hygiene-core
ExecStart=%h/SCRIPTS/hygiene-core/venv/bin/python %h/SCRIPTS/hygiene-core/hygiene.py
  1. Create the Timer: Create ~/.config/systemd/user/hygiene.timer:
[Unit]
Description=Run Hygiene-Core Every Monday at 00:00

[Timer]
OnCalendar=Mon *-*-* 00:00:00
Persistent=true

[Install]
WantedBy=timers.target
  1. Enable Everything:
systemctl --user daemon-reload
systemctl --user enable --now hygiene.timer

🛠 Module Writing Guide

Add a .py file to modules/. The orchestrator will auto-discover it.

class MyCustomModule:
    def __init__(self, config):
        self.config = config
    def run(self):
        return {"module": "Name", "status": "Success", "cleaned_mb": 10.0}

🇹🇷 TR

⚙️ Sistem Mimarisi

Hygiene-Core, Arch Linux sistemleri için tasarlanmış, modüler ve hafif bir bakım motorudur. Manuel temizlik işlerini otomatize eder, depolamayı optimize eder ve sonuçları Telegram üzerinden raporlar.

Telegram Report Example

✨ Özellikler

  • Modüler Tasarım: Her temizlik görevi modules/ altında bağımsız bir eklentidir.
  • Telegram Entegrasyonu: Temizlenen alan miktarını anında raporlar.
  • Güvenlik: Dry Run modu ve lsof kontrolü ile aktif dosyaları korur.
  • Düşük Öncelikli Çalışma: Systemd üzerinden idle modunda çalışarak sistem performansını etkilemez.

🛡️ Dry Run Modu

Varsayılan olarak Hygiene-Core, config.yaml dosyasında dry_run: true korumasıyla gelir. Bu modda sistem taranır, potansiyel olarak silinebilecek dosya boyutu hesaplanır ve Telegram'a rapor gönderilir, ancak hiçbir dosya fiziksel olarak silinmez. Sistemi gerçekten temizlemek (silme işlemlerini onaylamak) için yapılandırmayı değiştirin:

# config.yaml
dry_run: false

🚀 Hızlı Başlangıç

git clone [https://github.com/cybalp/Hygiene-Core](https://github.com/cybalp/Hygiene-Core)
cd Hygiene-Core
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
cp .env-example .env # Telegram bilgilerini girin

⏰ Systemd ile Otomasyon (Opsiyonel)

Hygiene-Core'un arka planda periyodik olarak (örneğin her Pazartesi 00:00'da) çalışması ve sistem seviyesindeki çöpleri temizlemeye yetkisi olması için:

  1. Gerekli özel root (sudo) izinlerini verin: Scriptin pacman ve journalctl için pürüzsüz çalışması adına aşağıdaki komutu terminalinize yapıştırın:
echo "$USER ALL=(root) NOPASSWD: /usr/bin/pacman -Sc --noconfirm, /usr/bin/pacman -Rns --noconfirm *, /usr/bin/journalctl --vacuum-size=*, /usr/bin/journalctl --vacuum-time=*" | sudo tee /etc/sudoers.d/hygiene-core > /dev/null && sudo chmod 0440 /etc/sudoers.d/hygiene-core && sudo visudo -c
  1. Systemd Servisini Oluşturun: ~/.config/systemd/user/hygiene.service dosyasını oluşturun:
[Unit]
Description=Hygiene-Core Maintenance Task
After=network-online.target

[Service]
Type=oneshot
WorkingDirectory=%h/SCRIPTS/hygiene-core
ExecStart=%h/SCRIPTS/hygiene-core/venv/bin/python %h/SCRIPTS/hygiene-core/hygiene.py
  1. Timer (Zamanlayıcı) Dosyasını Oluşturun: ~/.config/systemd/user/hygiene.timer dosyasını oluşturun:
[Unit]
Description=Run Hygiene-Core Every Monday at 00:00

[Timer]
OnCalendar=Mon *-*-* 00:00:00
Persistent=true

[Install]
WantedBy=timers.target
  1. Sistemi Başlatın ve Aktifleştirin:
systemctl --user daemon-reload
systemctl --user enable --now hygiene.timer

🛠 Modül Yazım Kılavuzu

modules/ dizinine bir .py dosyası ekleyin. Orchestrator onu otomatik olarak keşfedecektir.

class MyCustomModule:
    def __init__(self, config):
        self.config = config
    def run(self):
        return {"module": "Name", "status": "Success", "cleaned_mb": 10.0}

ꜱᴜᴘᴘᴏʀᴛꜱ ᴍᴇ ∞ ♡

Sponsor

Buy Me A Coffee



TKPTZj988cNC8vPwcexPz8mfrCzYtT7Gkq

USDT (TRC20)

About

Hygiene-Core is a modular, lightweight maintenance engine designed for Arch Linux. It automates manual cleanup tasks, optimizes system storage, and sends aesthetic reports via Telegram.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages