Commit eb9f3407 authored by thomas.forbriger's avatar thomas.forbriger

[TASK] (util): provide templates for three new utilities

parent 40ef38a2
......@@ -9,4 +9,21 @@ check the consistency of a csback maintained data archive with an approach
entirely independent of csback itself. They therefore might be useful to any
csback user.
These tools should be applied prior to the application of csbackchk.py
Tools
-----
csbulistcsfiles.sh
Lists all directories containing checksum files (or alternatively those
where checksum files are missing).
csbucheckcsfiles.sh
Check completeness of checksum files in the sense that the checksum file
must contain one entry per data file.
csbucomparecsfiles.sh
Check downstream data archives for checksum files. Report missing checksum
files and checksum files differing from the upstream file.
----- END OF util/README -----
#!/bin/sh
# this is <csbucheckcsfiles.sh>
# ----------------------------------------------------------------------------
#
# Copyright (c) 2016 by Thomas Forbriger (BFO Schiltach)
#
# check completeness of checksumfiles
#
# REVISIONS and CHANGES
# 06/06/2016 V1.0 Thomas Forbriger
#
# ============================================================================
#
VERSION="06/06/2016 V1.0"
# name of csback checksum files
CHECKSUMFILE="checksumfile.cs"
# usage function
function usage {
cat << HERE
This is <csbucheckcsfiles.sh>
version: $VERSION
usage: csbucheckcsfiles.sh [-v] [-d] dir [dir ...]
or: csbucheckcsfiles.sh -h
Check completeness of checksum files in the sense that the checksum file must
contain one entry per data file.
HERE
}
# usage function
function longusage {
cat << HERE
-h print detailed usage information
-v be verbose
-d print debug output
dir one or more directories to be checked recursively
The name of checksumfiles to be searched for is: $CHECKSUMFILE
HERE
}
verbose=0
debug=0
# fetch commandline arguments
while getopts 'hvd' Option;
do
case ${Option} in
h) hflag=1
usage; longusage; exit 0;;
v) verbose=1;;
d) debug=1;;
*) echo -e "ERROR: Unimplemented option chosen.\n"
usage; exit 2;;
esac
done
shift $((${OPTIND} - 1))
MINPARAMS=1
# check number of commandline arguments
if [ $# -lt ${MINPARAMS} ]
then
usage
exit 2
fi
# ----- END OF csbucheckcsfiles.sh -----
#!/bin/sh
# this is <csbucomparecsfiles.sh>
# ----------------------------------------------------------------------------
#
# Copyright (c) 2016 by Thomas Forbriger (BFO Schiltach)
#
# check downstream checksum files
#
# REVISIONS and CHANGES
# 06/06/2016 V1.0 Thomas Forbriger
#
# ============================================================================
#
VERSION="06/06/2016 V1.0"
# name of csback checksum files
CHECKSUMFILE="checksumfile.cs"
# usage function
function usage {
cat << HERE
This is <csbucomparecsfiles.sh>
version: $VERSION
usage: csbucomparecsfiles.sh [-v] [-d] dir [dir ...]
or: csbucomparecsfiles.sh -h
Check downstream data archives for checksum files. Report missing checksum
files and checksum files differing from the upstream file.
HERE
}
# usage function
function longusage {
cat << HERE
-h print detailed usage information
-v be verbose
-d print debug output
dir one or more directories to be checked recursively
The name of checksumfiles to be searched for is: $CHECKSUMFILE
HERE
}
verbose=0
debug=0
# fetch commandline arguments
while getopts 'hvd' Option;
do
case ${Option} in
h) hflag=1
usage; longusage; exit 0;;
v) verbose=1;;
d) debug=1;;
*) echo -e "ERROR: Unimplemented option chosen.\n"
usage; exit 2;;
esac
done
shift $((${OPTIND} - 1))
MINPARAMS=1
# check number of commandline arguments
if [ $# -lt ${MINPARAMS} ]
then
usage
exit 2
fi
# ----- END OF csbucomparecsfiles.sh -----
#!/bin/sh
# this is <csbulistcsfiles.sh>
# ----------------------------------------------------------------------------
#
# Copyright (c) 2016 by Thomas Forbriger (BFO Schiltach)
#
# list all directories containing checksum files
#
# REVISIONS and CHANGES
# 06/06/2016 V1.0 Thomas Forbriger
#
# ============================================================================
#
VERSION="06/06/2016 V1.0"
# name of csback checksum files
CHECKSUMFILE="checksumfile.cs"
# usage function
function usage {
cat << HERE
This is <csbulistcsfiles.sh>
version: $VERSION
usage: csbulistcsfiles.sh [-v] [-d] dir [dir ...]
or: csbulistcsfiles.sh -h
Lists all directories containing checksum files (or alternatively those where
checksum files are missing).
HERE
}
# usage function
function longusage {
cat << HERE
-h print detailed usage information
-v be verbose
-d print debug output
dir one or more directories to be checked recursively
The name of checksumfiles to be searched for is: $CHECKSUMFILE
HERE
}
verbose=0
debug=0
# fetch commandline arguments
while getopts 'hvd' Option;
do
case ${Option} in
h) hflag=1
usage; longusage; exit 0;;
v) verbose=1;;
d) debug=1;;
*) echo -e "ERROR: Unimplemented option chosen.\n"
usage; exit 2;;
esac
done
shift $((${OPTIND} - 1))
MINPARAMS=1
# check number of commandline arguments
if [ $# -lt ${MINPARAMS} ]
then
usage
exit 2
fi
# ----- END OF csbulistcsfiles.sh -----
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment