2020-04-18 10:29:21 +02:00
|
|
|
#!/bin/sh
|
2020-10-07 20:50:17 +02:00
|
|
|
#
|
|
|
|
# Run check on the last inc of all jails
|
|
|
|
# Usage: check-incs last
|
|
|
|
#
|
2020-04-18 10:29:21 +02:00
|
|
|
|
|
|
|
set -u
|
|
|
|
|
|
|
|
# shellcheck source=./includes
|
|
|
|
LIBDIR="$(dirname $0)" && . "${LIBDIR}/includes"
|
|
|
|
|
|
|
|
# default return value is 0 (succes)
|
|
|
|
rc=0
|
|
|
|
# loop for each found jail
|
2020-04-19 00:16:30 +02:00
|
|
|
for jail_name in $("${LIBDIR}/bkctld-list"); do
|
2020-04-18 10:29:21 +02:00
|
|
|
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
|