quak backup: print the date and time a run starts and finishes (closes #245)
check / check (push) Waiting to run
check / check (push) Waiting to run
Adds a `Started at` line after `Starting backup...` and a `Finished at` line after `--- Backup complete ---`, in local time with the UTC offset. No existing line changes. The clock comes in through `CliContext.now`. The README's crontab now pipes the output to `logger`, which adds its own time to each line; appending to a file remains as the alternative. Model: opus-5-5
This commit was merged in pull request #256.
This commit is contained in:
1 parent
2492946e9d
commit
ecdd90b0a8
6 files changed
+124
-19
No files matched your search
@@ -172,14 +172,21 @@ Log in once with `~/bin/quak`, as the user the cron job will run as:
|
||||
|
||||
The session is saved in that user's data directory (see "The session file").
|
||||
Then add the backup to that user's crontab with `crontab -e`. These two lines
|
||||
back up the account to `~/photos-backup` at 03:30 every night and append all
|
||||
output to `~/quak-backup.log`. Sunday's run adds `--verify`:
|
||||
back up the account to `~/photos-backup` at 03:30 every night and send all
|
||||
output to the system log with `logger`. Sunday's run adds `--verify`:
|
||||
|
||||
```
|
||||
30 3 * * 1-6 $HOME/bin/quak backup $HOME/photos-backup >> $HOME/quak-backup.log 2>&1
|
||||
30 3 * * 0 $HOME/bin/quak backup --verify $HOME/photos-backup >> $HOME/quak-backup.log 2>&1
|
||||
30 3 * * 1-6 $HOME/bin/quak backup $HOME/photos-backup 2>&1 | logger -t quak
|
||||
30 3 * * 0 $HOME/bin/quak backup --verify $HOME/photos-backup 2>&1 | logger -t quak
|
||||
```
|
||||
|
||||
On Linux with systemd, `logger` writes to the journal, and `journalctl -t quak`
|
||||
shows the runs. The system log adds the time to each line.
|
||||
|
||||
To keep the output in a file instead, end each line with
|
||||
`>> $HOME/quak-backup.log 2>&1` in place of the pipe. Each run's `Started at`
|
||||
and `Finished at` lines then show when it ran.
|
||||
|
||||
A run with `--verify` does all a plain run does. It also hashes each original
|
||||
already in the backup and compares the result with the content hash. The content
|
||||
hash is the hash of the file's bytes that Ente recorded at upload. The run
|
||||
@@ -363,10 +370,12 @@ once, however many collections hold it. An original the cache already holds is
|
||||
copied from there instead.
|
||||
|
||||
Progress goes to stderr: one line per original fetched, and a `FAILED` line for
|
||||
each original or album that failed. The run ends with a summary of counts and,
|
||||
when any file failed, a `Failed files:` list of every failed file. With
|
||||
`--json`, the summary and the list are replaced by one JSON object on stdout.
|
||||
Its fields are:
|
||||
each original or album that failed. The run starts with `Starting backup...` and
|
||||
a `Started at` line giving the local date and time, such as
|
||||
`Started at 2026-11-11 03:30:00 +0100`. It ends with a summary: a `Finished at`
|
||||
line in the same form, the counts and, when any file failed, a `Failed files:`
|
||||
list of every failed file. With `--json`, the summary and the list are replaced
|
||||
by one JSON object on stdout. Its fields are:
|
||||
|
||||
- `totalFiles`: how many distinct files the run covered, however many
|
||||
collections hold each;
|
||||
@@ -555,12 +564,12 @@ output, run `yarn --silent quak files --json` or
|
||||
`node dist/bin/quak.js files --json` instead.
|
||||
|
||||
With `--json`, a command's JSON on stdout takes the place of its summary on
|
||||
stderr. For `backup`, that is the `--- Backup complete ---` line, the counts and
|
||||
the `Failed files:` list. For `list-missing-thumbnails`, it is
|
||||
`No missing thumbnails found.` or `<n> file(s) with missing thumbnails:`. For
|
||||
`fix-missing-thumbnails`, it is the `--- Done ---` line, the counts, the
|
||||
`Skipped:` list and the `Failed files:` list. Every other line is logged as
|
||||
without `--json`.
|
||||
stderr. For `backup`, that is the `--- Backup complete ---` line, the
|
||||
`Finished at` line, the counts and the `Failed files:` list. For
|
||||
`list-missing-thumbnails`, it is `No missing thumbnails found.` or
|
||||
`<n> file(s) with missing thumbnails:`. For `fix-missing-thumbnails`, it is the
|
||||
`--- Done ---` line, the counts, the `Skipped:` list and the `Failed files:`
|
||||
list. Every other line is logged as without `--json`.
|
||||
|
||||
### Exit codes
|
||||
|
||||
|
||||
Reference in new issue
Block a user