ecc.1 (3745B)
1 .\" Copyright (C) 2023, 2024 Vincent Forest (vaplv@posteo.net) 2 .\" 3 .\" This program is free software: you can redistribute it and/or modify 4 .\" it under the terms of the GNU General Public License as published by 5 .\" the Free Software Foundation, either version 3 of the License, or 6 .\" (at your option) any later version. 7 .\" 8 .\" This program is distributed in the hope that it will be useful, 9 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of 10 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 .\" GNU General Public License for more details. 12 .\" 13 .\" You should have received a copy of the GNU General Public License 14 .\" along with this program. If not, see <http://www.gnu.org/licenses/>. 15 .Dd December 14, 2024 16 .Dt ECC 1 17 .Os 18 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 19 .Sh NAME 20 .Nm ecc 21 .Nd manage file error correction codes for verification/repair 22 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 23 .Sh SYNOPSIS 24 .Nm 25 .Cm create 26 .Ar file No ... 27 .Nm 28 .Cm verify 29 .Ar file No ... 30 .Nm 31 .Cm repair 32 .Ar file No ... 33 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 34 .Sh DESCRIPTION 35 .Nm 36 calculates the error correction code for files to check their integrity 37 and repair them in the event of corruption. 38 Internally, 39 .Nm 40 simply invokes 41 .Xr par2 1 42 and adds no new functionality to it. 43 Its sole purpose is to define a policy for using 44 .Xr par2 1 45 to simplify its use. 46 .Pp 47 The error correction code for a file calculated by 48 .Nm 49 is systematically stored in hidden files, alongside the file from which 50 it is taken. 51 In this way, the correction code data remains close to its associated 52 file without being too invasive. 53 .Pp 54 In addition to the 55 .Xr par2 1 56 messages displayed on standard output, 57 .Nm 58 also lists error messages on standard error, providing a simple way of 59 listing files whose error code calculation, verification or repair has 60 failed. 61 The error messages are formatted as follows: 62 .Bd -literal -offset Ds 63 "%s ecc %s error: %s\\n", date, command, filepath 64 .Ed 65 .Pp 66 with 67 .Ar command 68 the action 69 .Nm 70 performed, 71 .Ar filepath 72 the path to the file for which the error occurred and 73 .Ar date 74 the time at which the log was issued. 75 It is displayed as in the 76 following 77 .Xr date 1 78 command: 79 .Bd -literal -offset Ds 80 date +"%b %d %Y %H:%M:%S" 81 .Ed 82 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 83 .Sh EXIT STATUS 84 .Ex -std 85 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 86 .Sh EXAMPLES 87 Calculate the error correction code for a file: 88 .Bd -literal -offset Ds 89 ecc create my_file.bin 90 .Ed 91 .Pp 92 Calculate the error correction code for all pdf files in the current 93 directory: 94 .Bd -literal -offset Ds 95 ecc create *.pdf 96 .Ed 97 .Pp 98 Check all pdf files of the current directory. 99 Prints errors in the temporary 100 .Pa ecc.err 101 file: 102 .Bd -literal -offset Ds 103 ecc verify *.pdf 2>> "${TMPDIR:-/tmp}/ecc.err" 104 .Ed 105 .Pp 106 Calculate the error correction code for all files found recursively in 107 the current directory hierarchy, with the exception of error correction 108 code files that have already been created: 109 .Bd -literal -offset Ds 110 find . \\( -type f ! -name "*.par2" \\) \\ 111 -exec ecc create {} \\; 2>> "${TMPDIR:-/tmp}/ecc.err" 112 .Ed 113 .Pp 114 Check all the files in the current directory: 115 .Bd -literal -offset Ds 116 find . \\( ! -path . -prune -type f ! -name "*.par2" \\) \\ 117 -exec ecc verify {} \\; 2>> "${TMPDIR:-/tmp}/ecc.err" 118 .Ed 119 .Pp 120 Repair all files previously detected as corrupted and listed in the 121 temporary 122 .Pa ecc.err 123 file: 124 .Bd -literal -offset Ds 125 sed -n 's/^.\\+error: \\(.\\+\\)$/\\1/p' "${TMPDIR:-/tmp}/ecc.err" \\ 126 | xargs -I{} ecc repair "{}" 127 .Ed 128 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 129 .Sh SEE ALSO 130 .Xr par2 1