Initial commit; base scripting and systemd user event code for borg based backup
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
# nextcloud-borg-backup
|
||||
|
||||
Tägliches Borg-Backup des lokalen Nextcloud-Mounts nach Synology:
|
||||
|
||||
- Quelle: `/home/johannes/Nextcloud`
|
||||
- Ziel: `/net/thor/volume1/NetBackup/Nextcloud/borg-repo`
|
||||
- Historie: `4w`, also vier Wochen wiederherstellbare Archive
|
||||
- Betrieb: systemd User Timer, täglich um 03:15 Uhr mit Zufallsverzögerung
|
||||
- Restore: über CLI, Suche, Borg-Mount oder gezieltes Extrahieren
|
||||
|
||||
Das Projekt ist bewusst klein gehalten: eine Bash-CLI, Konfiguration, systemd-User-Units und Dokumentation. Es eignet sich direkt für ein Gitea-Repository.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
cd /home/johannes/localdev/nextcloud-borg-backup
|
||||
./scripts/install.sh
|
||||
```
|
||||
|
||||
Der Installer legt an:
|
||||
|
||||
- `~/.local/bin/nextcloud-borg-backup`
|
||||
- `~/.config/nextcloud-borg-backup/config`
|
||||
- `~/.config/nextcloud-borg-backup/passphrase`
|
||||
- `~/.config/systemd/user/nextcloud-borg-backup.service`
|
||||
- `~/.config/systemd/user/nextcloud-borg-backup.timer`
|
||||
|
||||
Der Installer überschreibt eine vorhandene Konfiguration nicht.
|
||||
|
||||
Danach den ersten Lauf manuell starten:
|
||||
|
||||
```bash
|
||||
systemctl --user start nextcloud-borg-backup.service
|
||||
journalctl --user -u nextcloud-borg-backup.service -f
|
||||
```
|
||||
|
||||
Timer prüfen:
|
||||
|
||||
```bash
|
||||
systemctl --user status nextcloud-borg-backup.timer
|
||||
systemctl --user list-timers nextcloud-borg-backup.timer
|
||||
```
|
||||
|
||||
Damit der User-Timer auch ohne aktive Anmeldung läuft:
|
||||
|
||||
```bash
|
||||
sudo loginctl enable-linger johannes
|
||||
```
|
||||
|
||||
## Bedienung
|
||||
|
||||
```bash
|
||||
nextcloud-borg-backup backup
|
||||
nextcloud-borg-backup list
|
||||
nextcloud-borg-backup status
|
||||
nextcloud-borg-backup search Rechnung
|
||||
nextcloud-borg-backup mount
|
||||
nextcloud-borg-backup restore
|
||||
nextcloud-borg-backup check --verify-data
|
||||
```
|
||||
|
||||
## Restore-Beispiele
|
||||
|
||||
Neuestes Archiv komplett nach `~/Nextcloud-Restore/<Archivname>` wiederherstellen:
|
||||
|
||||
```bash
|
||||
nextcloud-borg-backup restore
|
||||
```
|
||||
|
||||
Bestimmte Datei im neuesten Archiv wiederherstellen:
|
||||
|
||||
```bash
|
||||
nextcloud-borg-backup restore "" "Dokumente/Beispiel.pdf"
|
||||
```
|
||||
|
||||
Bestimmtes Archiv und bestimmten Pfad wiederherstellen:
|
||||
|
||||
```bash
|
||||
nextcloud-borg-backup restore nextcloud-2026-07-10_03-15-00 "Dokumente"
|
||||
```
|
||||
|
||||
Archive bequem lesbar mounten:
|
||||
|
||||
```bash
|
||||
nextcloud-borg-backup mount
|
||||
xdg-open "${XDG_RUNTIME_DIR}/nextcloud-borg-backup-mount"
|
||||
nextcloud-borg-backup umount
|
||||
```
|
||||
|
||||
## Wichtige Hinweise
|
||||
|
||||
Die Borg-Passphrase liegt lokal in `~/.config/nextcloud-borg-backup/passphrase`. Ohne diese Datei kann ein verschlüsseltes Borg-Repository im Notfall nicht wiederhergestellt werden. Eine Kopie gehört daher separat und sicher abgelegt.
|
||||
|
||||
Weitere Details stehen in [Dokumentation.md](Dokumentation.md).
|
||||
Reference in New Issue
Block a user