|1.3.0||Sep 19, 2023|
|1.2.0||Sep 3, 2023|
|1.1.1||Sep 3, 2023|
|1.0.0||Aug 31, 2023|
#312 in Command line utilities
28 downloads per month
╔═╗ ╦ ╦ ╔═╗ ╔═╗ ╦╔═ ╔═╗ ╦ ╦ ╔═╗ ║ ╠═╣ ║╣ ║ ╠╩╗ ╠╣ ║ ║ ║╣ ╚═╝ ╩ ╩ ╚═╝ ╚═╝ ╩ ╩ ╚ ╩ ╩═╝ ╚═╝
A command line tool that logs the checksum and last 50 lines of each file in a folder written in rust
I use this to verify some backblaze log files and to see how things are changing that may cause unwanted safety freezes.
You can install this tool via the crates cargo ecosystem:
λ cargo install checkfile
cd into a folder and just run the tool with its defaults:
λ cd path/to/folder λ checkfile The log for 11 files was written successfully to ./checkfile.log Finished in 1.30ms
This will create a file called
checkfile.log that contains the name, checksum and last 50 lines (in reverse order) of each file found in the current directory.
The format of the
checkfile.log is as follows:
## NAME ./your_file1.ext ## HASH 54d0aee5a905190551f607309d162ff7d970f845ac646da13469da004d8c8b63 --> last line second last line third last line [...] contents of file <-- ## NAME ./your_file2.ext ## HASH 895344059424ed7f5b1946d80c0e2581e30fc2032584db6dc36c608849e6f165 --> contents of file [...] contents of file <-- ## NAME ./your_file3.ext ## HASH 104f62f4e75447518c3de21b9de71e757c0b7d719de77d36e81a024394777a53 --> contents of file [...] contents of file <--
a cron job to schedule
checkfile to run every 6 hours and add the log to a folder.
If something is wrong with the backblaze backup I can go into that folder and introspect what may have happened.
#!/bin/sh checkfile -o ~/Desktop/logs/checkfile-$(date +%s).log /Library/Backblaze.bzpkg/bzdata/bzbackup/bzdatacenter
And the cron job:
λ crontab -l 0 */6 * * * /bin/sh ~/checkfile.sh >> ~/Desktop/logs/error.log
Set the directory you would like to run
λ checkfile /path/to/folder
Set this output file name and path.
λ checkfile -o /path/to/folder/yourfile.log
💡 Note: This will not create non-existing folder so the path has to exist
Set this amount of lines that should be included into the log file for each checked file.
λ checkfile -l 10
Set to include dot files in your log.
λ checkfile -d
💡 Note: If checkfiles encounters a binary file it will try to read it and mark lines it couldn't with
[- binary data -]
Reverse the output lines so they look the same way the files look (mirror what
λ checkfile -r
The output file without the
## NAME ./your_file.ext ## HASH 54d0aee5a905190551f607309d162ff7d970f845ac646da13469da004d8c8b63 --> last line second last line third last line <--
The output file with the
## NAME ./your_file.ext ## HASH 54d0aee5a905190551f607309d162ff7d970f845ac646da13469da004d8c8b63 --> third last line second last line last line <--
For comparison, the contents of
third last line second last line last line
Copyleft (c) 2023 Dominik Wilkowski. Licensed under the GNU GPL-3.0-or-later.