systools

System management tools
git clone git://git.meso-star.fr/systools.git
Log | Files | Refs | README | LICENSE

commit 9e5ea25c51abbb83d8a0a6d23f5a29eae5125da7
parent 9badac0cb832a6bc133c22a7b617f39dce635a09
Author: vaplv <vaplv@posteo.net>
Date:   Sun,  1 Oct 2023 18:42:10 +0200

Write backup man page

Diffstat:
MMakefile | 3+++
Abackup.8 | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 91 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -20,7 +20,10 @@ default: lint: shellcheck -o all backup + mandoc -T lint backup.8 install: mkdir -p $(DESTDIR)$(PREFIX)/bin + mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8/ cp backup $(DESTDIR)$(PREFIX)/bin + cp backup.8 $(DESTDIR)$(PREFIX)/share/man/man8/ diff --git a/backup.8 b/backup.8 @@ -0,0 +1,88 @@ +.\" Copyright (C) 2023 vaplv (vaplv@posteo.net) +.\" +.\" This program is free software: you can redistribute it and/or modify +.\" it under the terms of the GNU General Public License as published by +.\" the Free Software Foundation, either version 3 of the License, or +.\" (at your option) any later version. +.\" +.\" This program is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with this program. If not, see <http://www.gnu.org/licenses/>. +.Dd October 1, 2023 +.Dt BACKUP 8 +.Os +.Sh NAME +.Nm backup +.Nd filesystem backup +.Sh SYNOPSIS +.Nm +.Pa backup_dir +.Pa files_to_backup ... +.Sh DESCRIPTION +.Nm +backups the files listed in the +.Pa files_to_backup +arguments to the +.Pa backup_dir +directory. +It is a shell script that relies on the +.Xr dump 8 +utility to provide an incremental backup strategy based on the Tower of +Hanoi sequence. +.Pp +A complete backup cycle is built around 3 consecutive Tower of Hanoi +sequences. +The first sequence begins with a full backup +.Pq level 0 . +The other two sequences begin with an incremental backup of level 1. +This is the only level that will have several files +.Pq in this case 2 +during a complete backup cycle. +.Pp +The dump levels of a complete backup cycle are as follows: +.Bd -literal -offset Ds +0 -> 3 -> 2 -> 5 -> 4 -> 7 -> 6 -> 9 -> 8 +1a -> 3 -> 2 -> 5 -> 4 -> 7 -> 6 -> 9 -> 8 +1b -> 3 -> 2 -> 5 -> 4 -> 7 -> 6 -> 9 -> 8 -> 0 +.Ed +.Pp +The identifiers used to define the next backup file are stored in the +file defined by the +.Ev NEXTBACKUP +environment variable. +The dump level between +.Bq 0, 9 +is listed first, followed by a space and the index of the Hanoi Tower +sequence number +.Pq between Bq 0, 2 . +.Sh ENVIRONMENT +.Bl -tag -width Ds +.It Ev NEXTBACKUP +File in which identifiers for the next backup file are stored. +Default is +.Pa /etc/nextbackup . +.El +.Sh EXIT STATUS +.Ex -std +.Sh EXAMPLES +Daily backup of partition +.Pa /dev/sda3 +in +.Pa /mnt/storage . +Note that in this example, backups are performed manually, but that +.Xr cron 8 +could be used to automate the process: +.Bd -literal -offset Ds +backup /mnt/storage /dev/sda3 # Day 1 -> Level 0 +backup /mnt/storage /dev/sda3 # Day 2 -> level 3 +backup /mnt/storage /dev/sda3 # Day 3 -> level 2 +backup /mnt/storage /dev/sda3 # Day 4 -> level 5 +\&... +.Ed +.Sh SEE ALSO +.Xr cron 8 , +.Xr dump 8