Log the exit summary of the status command

This commit is contained in:
Andrea Mazzoleni 2026-01-16 00:28:12 +01:00
parent a11938497e
commit a7e9cdd8c6
4 changed files with 157 additions and 84 deletions

View file

@ -575,6 +575,13 @@ int state_status(struct snapraid_state* state)
printf("No error detected.\n");
}
if (bad)
log_tag("summary:exit:bad\n");
else if (unsynced_blocks)
log_tag("summary:exit:unsynced\n");
else
log_tag("summary:exit:ok\n");
/* free the temp vector */
free(timemap);

View file

@ -336,13 +336,21 @@ protected file to a new path (uint).
Total number of new files matching a parity entry by
name/time/size but with a new inode (uint).
.TP
.B summary:exit:equal
A zero\-argument tag indicating that no differences were found.
.B summary:exit:<status>
Logs the overall exit status of the command. The \`status\` is
one of the following:
.RS 4
.PD 0
.HP 4
.I equal
Indicates that no differences were found.
The array is already synchronized.
.TP
.B summary:exit:diff
A zero\-argument tag indicating that differences were found.
.HP 4
.I diff
Indicates that differences were found.
The array needs a \`sync\` operation.
.PD
.RE
.SH GENERAL PROGRESS AND EXECUTION TAGS
These tags are used to report the runtime processing of the commands
\`sync\`, \`scrub\`, \`check\` and \`fix\`.
@ -726,6 +734,26 @@ Days ago the median block was last scrubbed.
.TP
.B summary:scrub_newest_days:<uint>
Days ago the newest block was last scrubbed.
.TP
.B summary:exit:<status>
Logs the overall exit status of the command. The \`status\` is
one of the following:
.RS 4
.PD 0
.HP 4
.I ok
No issues. The array is fully synchronized and healthy.
.HP 4
.I bad
The array has some blocks marked as bad.
The array needs a \`\-e fix\` and and a \`\-p bad scrub\`
operation.
.HP 4
.I unsynced
The array has an interrupted sync.
The array needs another \`sync\` operation.
.PD
.RE
.SS Per\-Disk Tags
These tags provide statistics for individual data disks. <name>
is the disk name.
@ -1404,14 +1432,19 @@ The total size of duplicate files in gigabytes (uint64).
.PD
.RE
.TP
.B summary:exit:unique
Logs the final exit status indicating that no duplicate files were
found. This tag is logged if \`<count>\` is zero.
.TP
.B summary:exit:dup
Logs the final exit status indicating that at least one duplicate
file was found. This tag is logged if \`<count>\` is greater than
zero.
.B summary:exit:<status>
Logs the overall exit status of the command. The \`status\` is one of
the following:
.RS 4
.PD 0
.HP 4
.I unique
Indicates that no duplicate files were found.
.HP 4
.I dup
Indicates that at least one duplicate file was found.
.PD
.RE
.SH COMMAND POOL TAGS
This section describes the tags output with the \`pool\` command.
.TP
@ -1434,21 +1467,29 @@ This section describes the tags output with the \`rehash\` command.
.SS Summary Tags
These tags provide a final summary of the rehash scheduling process.
.TP
.B summary:exit:scheduled
Logs the final exit status indicating that a rehash operation has
.B summary:exit:<status>
Logs the overall exit status of the command. The \`status\` is one of
the following:
.RS 4
.PD 0
.HP 4
.I scheduled
Indicates that a rehash operation has
been successfully scheduled. The rehash will be performed
incrementally in future \`sync\` or \`scrub\` commands.
.TP
.B summary:exit:already_in_progress
Logs the final exit status indicating that a rehash is already
.HP 4
.I already_in_progress
Indicates that that a rehash is already
in progress and cannot be scheduled again. This causes the
program to exit with a fatal error.
.TP
.B summary:exit:not_required
Logs the final exit status indicating that the current hash
algorithm is already the \`best hash\` for the platform, and thus
a rehash is not required. This causes the program to exit with
a fatal error.
.HP 4
.I not_required
Indicates that the current hash algorithm is
already the \`best hash\` for the platform, and thus
a rehash is not required. This causes the program to
exit with a fatal error.
.PD
.RE
.SH COMMAND SMART AND PROBE TAGS
This section describes the tags output by the \`smart\` and \`probe\`
commands. The main difference between the two is that \`probe\` doesn\'t

View file

@ -253,13 +253,14 @@ Scan Tags
Total number of new files matching a parity entry by
name/time/size but with a new inode (uint).
=summary:exit:equal
A zero-argument tag indicating that no differences were found.
The array is already synchronized.
=summary:exit:diff
A zero-argument tag indicating that differences were found.
The array needs a `sync` operation.
=summary:exit:<status>
Logs the overall exit status of the command. The `status` is
one of the following:
equal - Indicates that no differences were found.
The array is already synchronized.
diff - Indicates that differences were found.
The array needs a `sync` operation.
General Progress and Execution Tags
These tags are used to report the runtime processing of the commands
@ -490,6 +491,16 @@ Command Status Tags
Days ago the median block was last scrubbed.
=summary:scrub_newest_days:<uint>
Days ago the newest block was last scrubbed.
=summary:exit:<status>
Logs the overall exit status of the command. The `status` is
one of the following:
ok - No issues. The array is fully synchronized and healthy.
bad - The array has some blocks marked as bad.
The array needs a `-e fix` and and a `-p bad scrub`
operation.
unsynced - The array has an interrupted sync.
The array needs another `sync` operation.
Per-Disk Tags
These tags provide statistics for individual data disks. <name>
@ -885,14 +896,12 @@ Command Dup Tags
<size> - The total size of duplicate files in gigabytes (uint64).
=summary:exit:unique
Logs the final exit status indicating that no duplicate files were
found. This tag is logged if `<count>` is zero.
=summary:exit:<status>
Logs the overall exit status of the command. The `status` is one of
the following:
=summary:exit:dup
Logs the final exit status indicating that at least one duplicate
file was found. This tag is logged if `<count>` is greater than
zero.
unique - Indicates that no duplicate files were found.
dup - Indicates that at least one duplicate file was found.
Command Pool Tags
This section describes the tags output with the `pool` command.
@ -913,21 +922,20 @@ Command Rehash Tags
Summary Tags
These tags provide a final summary of the rehash scheduling process.
=summary:exit:scheduled
Logs the final exit status indicating that a rehash operation has
been successfully scheduled. The rehash will be performed
incrementally in future `sync` or `scrub` commands.
=summary:exit:already_in_progress
Logs the final exit status indicating that a rehash is already
in progress and cannot be scheduled again. This causes the
program to exit with a fatal error.
=summary:exit:not_required
Logs the final exit status indicating that the current hash
algorithm is already the `best hash` for the platform, and thus
a rehash is not required. This causes the program to exit with
a fatal error.
=summary:exit:<status>
Logs the overall exit status of the command. The `status` is one of
the following:
scheduled - Indicates that a rehash operation has
been successfully scheduled. The rehash will be performed
incrementally in future `sync` or `scrub` commands.
already_in_progress - Indicates that that a rehash is already
in progress and cannot be scheduled again. This causes the
program to exit with a fatal error.
not_required - Indicates that the current hash algorithm is
already the `best hash` for the platform, and thus
a rehash is not required. This causes the program to
exit with a fatal error.
Command Smart And Probe Tags
This section describes the tags output by the `smart` and `probe`

View file

@ -238,32 +238,40 @@ content file. They are output for every discovered change, and
These tags provide a final count of all detected changes.
summary:equal:<count>
Total number of equal (unchanged) files/links/firs found (uint).
Total number of files/dirs/links whose metadata and data match
the current parity (uint).
summary:added:<count>
Total number of new files/links/dirs found (uint).
Total number of new brand new files/dirs/links that have no
relationship to existing parity (uint).
summary:removed:<count>
Total number of removed files/links/dirs found (uint).
Total number of files/dirs/links that existed in the last sync
but are now missing (uint).
summary:updated:<count>
Total number of updated files/links found (uint).
Total number of existing files where the timestamp or size has
changed (uint).
summary:moved:<count>
Total number of moved files found (uint).
Total number of files relocated to a new path but retaining
the same inode (uint).
summary:copied:<count>
Total number of copied files found (uint).
Total number of new files created by copying an existing
protected file to a new path (uint).
summary:restored:<count>
Total number of restored files found (uint).
Total number of new files matching a parity entry by
name/time/size but with a new inode (uint).
summary:exit:equal
A zero-argument tag indicating that no differences were found.
summary:exit:<status>
Logs the overall exit status of the command. The `status` is
one of the following:
equal - Indicates that no differences were found.
The array is already synchronized.
summary:exit:diff
A zero-argument tag indicating that differences were found.
diff - Indicates that differences were found.
The array needs a `sync` operation.
@ -504,6 +512,16 @@ and overall state.
Days ago the median block was last scrubbed.
summary:scrub_newest_days:<uint>
Days ago the newest block was last scrubbed.
summary:exit:<status>
Logs the overall exit status of the command. The `status` is
one of the following:
ok - No issues. The array is fully synchronized and healthy.
bad - The array has some blocks marked as bad.
The array needs a `-e fix` and and a `-p bad scrub`
operation.
unsynced - The array has an interrupted sync.
The array needs another `sync` operation.
---- 7.0.2 Per-Disk Tags ----
These tags provide statistics for individual data disks. <name>
@ -911,14 +929,12 @@ These tags provide a final summary of the duplicate finding process.
<size> - The total size of duplicate files in gigabytes (uint64).
summary:exit:unique
Logs the final exit status indicating that no duplicate files were
found. This tag is logged if `<count>` is zero.
summary:exit:<status>
Logs the overall exit status of the command. The `status` is one of
the following:
summary:exit:dup
Logs the final exit status indicating that at least one duplicate
file was found. This tag is logged if `<count>` is greater than
zero.
unique - Indicates that no duplicate files were found.
dup - Indicates that at least one duplicate file was found.
12 COMMAND POOL TAGS
@ -945,21 +961,20 @@ This section describes the tags output with the `rehash` command.
---- 13.0.1 Summary Tags ----
These tags provide a final summary of the rehash scheduling process.
summary:exit:scheduled
Logs the final exit status indicating that a rehash operation has
summary:exit:<status>
Logs the overall exit status of the command. The `status` is one of
the following:
scheduled - Indicates that a rehash operation has
been successfully scheduled. The rehash will be performed
incrementally in future `sync` or `scrub` commands.
summary:exit:already_in_progress
Logs the final exit status indicating that a rehash is already
already_in_progress - Indicates that that a rehash is already
in progress and cannot be scheduled again. This causes the
program to exit with a fatal error.
summary:exit:not_required
Logs the final exit status indicating that the current hash
algorithm is already the `best hash` for the platform, and thus
a rehash is not required. This causes the program to exit with
a fatal error.
not_required - Indicates that the current hash algorithm is
already the `best hash` for the platform, and thus
a rehash is not required. This causes the program to
exit with a fatal error.
14 COMMAND SMART AND PROBE TAGS
@ -1155,7 +1170,9 @@ commands that access files and parities.
parity_error[_io|_data]:<block>:<level>:<msg>
Logs errors during parity disk read or write operations.
---- 16.0.1 _io - Indicates a physical Input/Output error. ----
_io - Indicates a physical Input/Output error.
The disk was unable to read or write a specific block,
typically signaling a failing sector or cable issue.
_data - Indicates the data was read successfully but failed
the checksum/hash verification. This signals `silent`
corruption or an unsuccessful parity match.