For batch mode of checkpresentkey
, it could be useful to have the option of outputting the key in a second (space- or tab-delimited?) column in addition to the 0/1
status indicator for that key; this could be useful for reporting, error recovery, or further key-specific action based on output. Presently it seems the only way to accomplish this would be to independently track corresponding input and output line indices, or externally join input and output (e.g., via the *nix paste
command).
Thank you!
Hmm, my assumption is that use of checkpresentkey --batch is in some kind of loop, or function call, where you'd write a key to it, read a response back, and now you know whether that key is present.
Does your use case involve something like shell scripting? I suppose if you have a big list of keys and want to narrow it to only keys that are present or missing, you could be trying to pipe it through checkpresentkey --batch.
Exactly: shell scripting, "big list of keys and want to narrow it to only keys that are present or missing".
My motivating use case is as a sanity check that all keys have been successfully transferred on a Ceph S3 instance internally (i.e.,
s3cmd cp s3://sourcebucket/[annex-key] s3://destbucket/[annex-key]
, without being read back to the local machine and separately written back up to a different bucket on the same server and locally deleted). Post-transfer, I want to check that all keys are present as expected, but in the event that a failed transfer is detected, I'd like to be able to report a specific key back to the operator/calling script.I'm thinking that if one is running
checkpresentkey
in batch mode (with multiple keys at once), there are many useful things one might want to do with the output that would require associating output status indicators with input keys; and since the output ofcheckpresentkey --batch
is so terse, it could optionally be extended without too much parsing/escaping/etc complication.Thanks for considering this, and apologies that the initial request was a bit cryptic about the use case!