evobackup/server/lib/bkctld-check-last-incs

32 lines
777 B
Bash
Executable file

#!/bin/sh
#
# Description: Run check on the last inc of all jails
# Usage: check-incs last
#
set -u
# shellcheck source=./includes
LIBDIR="$(dirname $0)" && . "${LIBDIR}/includes"
# default return value is 0 (succes)
rc=0
# loop for each found jail
for jail_name in $("${LIBDIR}/bkctld-list"); do
incs_policy_file=$(current_jail_incs_policy_file "${jail_name}")
if [ -n "${incs_policy_file}" ]; then
# inc date in seconds from epoch
inc_date=$(date +"%Y-%m-%d")
# Error if inc is not found
if ! inc_exists "${jail_name}" "${inc_date}*"; then
echo "ERROR: ${jail_name} : missing inc for ${inc_date}" >&2
rc=1
fi
else
echo "INFO: ${jail_name} : no inc expected at all"
fi
done
exit $rc