Cron hinzugefuegt
This commit is contained in:
parent
05287cce70
commit
b3e0a9fc68
39
README.md
39
README.md
@ -58,6 +58,45 @@ Das Script liest automatisch `pbs-backup.v2.conf` aus dem Script-Verzeichnis. Ei
|
||||
- Ruhige Ausgabe und ohne Ntfy:
|
||||
`./pbs-backup.v2.sh -q --no-ntfy`
|
||||
|
||||
## Cronjob
|
||||
|
||||
Das Script besitzt eigenes Locking (`flock`) und ist damit für periodische Ausführung per Cron geeignet. Für Backups von Pfaden wie `/root` oder `/var/lib/docker/volumes/` sollte der Cronjob als **root** laufen.
|
||||
|
||||
### Variante A: `/etc/crontab` (empfohlen)
|
||||
~~~cron
|
||||
# /etc/crontab
|
||||
SHELL=/bin/bash
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
MAILTO=""
|
||||
|
||||
# Täglich um 02:30 Uhr ausführen
|
||||
30 2 * * * root CONFIG_FILE=/etc/pbs-backup.v2.conf /usr/local/sbin/pbs-backup.v2.sh >> /var/log/pbs-backup.cron.log 2>&1
|
||||
|
||||
# Optional schonender (CPU/IO) und mit reduzierter Ausgabe:
|
||||
#30 2 * * * root ionice -c2 -n7 nice -n 10 CONFIG_FILE=/etc/pbs-backup.v2.conf /usr/local/sbin/pbs-backup.v2.sh -q >> /var/log/pbs-backup.cron.log 2>&1
|
||||
~~~
|
||||
|
||||
### Variante B: Benutzer-Crontab (nur wenn alle Pfade lesbar sind)
|
||||
~~~bash
|
||||
crontab -e
|
||||
~~~
|
||||
~~~cron
|
||||
# Täglich um 02:30 Uhr (User-Crontab)
|
||||
SHELL=/bin/bash
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
MAILTO=""
|
||||
|
||||
30 2 * * * CONFIG_FILE=/etc/pbs-backup.v2.conf /usr/local/sbin/pbs-backup.v2.sh >> /var/log/pbs-backup.cron.log 2>&1
|
||||
~~~
|
||||
|
||||
**Hinweise**
|
||||
- Verwende **absolute Pfade** zum Script und zur Config.
|
||||
- Die Script-Ausgabe landet zusätzlich im in der Config definierten `LOGFILE`. Der Cron-Redirect (`>> /var/log/pbs-backup.cron.log 2>&1`) ist optional als zusätzlicher Laufverlauf.
|
||||
- Erst mit `--dry-run` testen:
|
||||
~~~bash
|
||||
CONFIG_FILE=/etc/pbs-backup.v2.conf /usr/local/sbin/pbs-backup.v2.sh --dry-run
|
||||
~~~
|
||||
|
||||
---
|
||||
|
||||
## Abhängigkeiten & Installation (x86_64, Ubuntu 22.04/24.04)
|
||||
|
Loading…
x
Reference in New Issue
Block a user