Save the last successful backup and add --last-backup

Write the completion time and backup directory to
$XDG_STATE_HOME/simple_backup/last_backup after each successful backup
(as the target user when run as root), for status bar reminders.
--last-backup prints it.
This commit is contained in:
Fuxino
2026-10-25 12:36:00 +01:00
parent 7547db1ea8
commit 6d54019a18
7 changed files with 306 additions and 5 deletions
+15
View File
@@ -145,6 +145,11 @@ needs to be allowed to run without password in the same way.
.TP
.B \-\-numeric\-ids
Use rsync \-\-numeric\-ids option. This causes rsync to use numeric uid/gid instead of trying to map uid/gid names from the local machine to the server.
.TP
.B \-\-last\-backup
Print the date and directory of the last successful backup, then exit. The exit status is 0, or 1
if no backup has been recorded yet or the state file can\(aqt be read (see
.BR FILES ).
.SH CONFIGURATION
An example configuration file is provided at \(aq/usr/share/doc/simple_backup/simple_backup.conf\(aq.
Copy it to the default location ($HOME/.config/simple_backup) and edit it as needed.
@@ -216,6 +221,16 @@ SSH connection failed.
.TP
.B 6
Bad configuration file or options (for example, only one of SSH host and SSH user specified).
.SH FILES
.TP
.I $XDG_STATE_HOME/simple_backup/last_backup
Written after each successful backup (local or remote), replacing the previous one. The first line
is the completion time in ISO 8601 format with the UTC offset (for example
\(aq2026\-10\-25T14:03:12+02:00\(aq), the second line the backup directory (prefixed with
\(aquser@host:\(aq for remote backups). The default location is
\fI~/.local/state/simple_backup/last_backup\fR. When running as root with sudo, doas or \-\-user,
the file is written to that user\(aqs \fI~/.local/state\fR and owned by them. Useful for scripts
that remind you when a backup is overdue.
.SH SEE ALSO
.BR rsync (1)
.SH AUTHORS