evobackup/lib/bkctld-check-last-incs

28 lines
682 B
Bash
Executable file

#!/bin/sh
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 $(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