verbesserung der README.md
This commit is contained in:
+86
-14
@@ -2,25 +2,31 @@
|
|||||||
|
|
||||||
Dieses Repository enthält ein automatisiertes Cleanup-System für temporäre Dateien im Nextcloud-synchronisierten Dokumente-Ordner.
|
Dieses Repository enthält ein automatisiertes Cleanup-System für temporäre Dateien im Nextcloud-synchronisierten Dokumente-Ordner.
|
||||||
|
|
||||||
|
Es entfernt automatisch Dateien und leere Ordner nach 30 Tagen und sorgt so für eine saubere, schlanke Synchronisationsstruktur.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# 📁 Projektstruktur
|
# 📁 Projektstruktur
|
||||||
|
|
||||||
|
```
|
||||||
workstation-config/
|
workstation-config/
|
||||||
└── temp-cleanup/
|
└── temp-cleanup/
|
||||||
├── cleanup_temp.sh
|
├── cleanup_temp.sh
|
||||||
├── cleanup_temp.log
|
├── cleanup_temp.log
|
||||||
└── systemd/
|
└── systemd/
|
||||||
└── cleanup-temp.service
|
└── cleanup-temp.service
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# ⚙️ Zweck
|
# ⚙️ Zweck
|
||||||
|
|
||||||
Das Script löscht automatisch Dateien und leere Ordner im definierten `temp`-Verzeichnis nach 30 Tagen.
|
Das Script bereinigt automatisch das definierte `temp`-Verzeichnis.
|
||||||
|
|
||||||
Ziel:
|
Ziel:
|
||||||
- Verhindern von Datenmüll in synchronisierten Nextcloud-Ordnern
|
- Verhindern von Datenmüll in synchronisierten Nextcloud-Ordnern
|
||||||
- Automatische Aufräumprozesse auf Workstations
|
- Automatisches Entfernen alter temporärer Dateien
|
||||||
|
- Aufräumen leerer Verzeichnisse
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -28,28 +34,94 @@ Ziel:
|
|||||||
|
|
||||||
Der Service wird über **systemd (User oder System Service)** ausgeführt.
|
Der Service wird über **systemd (User oder System Service)** ausgeführt.
|
||||||
|
|
||||||
## 📍 Typischer Pfad (Installation auf Laptop)
|
## 📍 Installationspfade (Laptop)
|
||||||
|
|
||||||
```bash
|
### Script
|
||||||
/home/kai/workstation-config/temp-cleanup/cleanup_temp.sh
|
/home/kai/workstation-config/temp-cleanup/cleanup_temp.sh
|
||||||
|
|
||||||
|
### Service Datei (im Repo)
|
||||||
/home/kai/workstation-config/temp-cleanup/systemd/cleanup-temp.service
|
/home/kai/workstation-config/temp-cleanup/systemd/cleanup-temp.service
|
||||||
muss kopiert werden nach
|
|
||||||
|
### Zielort für systemd (User Service)
|
||||||
~/.config/systemd/user/cleanup-temp.service
|
~/.config/systemd/user/cleanup-temp.service
|
||||||
|
|
||||||
🕒 Ausführungszeitpunkt
|
👉 Die Service-Datei muss bei Änderungen manuell kopiert werden.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 🔄 Service Installation / Reload
|
||||||
|
|
||||||
|
Nach Änderungen der Service-Datei:
|
||||||
|
|
||||||
|
cp ~/workstation-config/temp-cleanup/systemd/cleanup-temp.service ~/.config/systemd/user/
|
||||||
|
systemctl --user daemon-reload
|
||||||
|
systemctl --user restart cleanup-temp.service
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 🕒 Ausführungszeitpunkt
|
||||||
|
|
||||||
Der Service wird ausgeführt über systemd Trigger, z. B.:
|
Der Service wird ausgeführt über systemd Trigger, z. B.:
|
||||||
|
|
||||||
beim Login (User Service)
|
- beim Login (User Service)
|
||||||
oder beim Systemstart (System Service)
|
- beim Systemstart (optional System Service)
|
||||||
optional manuell über systemctl start
|
- manuell über systemctl start
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
📜 Logfile
|
# 📜 Logfile
|
||||||
|
|
||||||
Alle Aktionen werden protokolliert in:
|
Alle Aktionen werden protokolliert in:
|
||||||
|
|
||||||
/home/kai/cleanup_temp.log
|
/home/kai/cleanup_temp.log
|
||||||
|
|
||||||
|
Enthält:
|
||||||
|
- gelöschte Dateien
|
||||||
|
- gelöschte Ordner
|
||||||
|
- Zeitstempel
|
||||||
|
- Fehlerausgaben (falls vorhanden)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 🧪 Manueller Test
|
||||||
|
|
||||||
|
## Script direkt ausführen
|
||||||
|
~/workstation-config/temp-cleanup/cleanup_temp.sh
|
||||||
|
|
||||||
|
## Testdateien erstellen (älter als 30 Tage simulieren)
|
||||||
|
mkdir -p ~/Dokumente/temp
|
||||||
|
touch -d "40 days ago" ~/Dokumente/temp/test_old_file.txt
|
||||||
|
|
||||||
|
## Testlauf starten
|
||||||
|
~/workstation-config/temp-cleanup/cleanup_temp.sh
|
||||||
|
|
||||||
|
## Ergebnis prüfen
|
||||||
|
ls -la ~/Dokumente/temp
|
||||||
|
cat ~/cleanup_temp.log
|
||||||
|
|
||||||
|
## Leere Ordner testen
|
||||||
|
mkdir -p ~/Dokumente/temp/old_folder
|
||||||
|
~/workstation-config/temp-cleanup/cleanup_temp.sh
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 🧠 Designprinzip
|
||||||
|
|
||||||
|
- Script ist portabel und läuft auf allen Workstations identisch
|
||||||
|
- Service wird bewusst nicht automatisch installiert
|
||||||
|
- Änderungen an Service-Dateien müssen manuell synchronisiert werden
|
||||||
|
- Logs bleiben lokal und werden nicht versioniert
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 🔄 Versionierung
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit -m "Update cleanup system"
|
||||||
|
git push origin main
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 🧩 Zielbild
|
||||||
|
|
||||||
|
git clone <repo>
|
||||||
Reference in New Issue
Block a user