#!/bin/bash -e

CHECK_DIRECTORY="$1"

if [ ! -d "${CHECK_DIRECTORY}" ]; then
    echo "Not a valid directory: ${CHECK_DIRECTORY}"
    exit 1
fi

files_found=$(find "${CHECK_DIRECTORY}" -ctime -1 -type f ! -empty)

if [ "${files_found}" = "" ]; then
    echo "No new files found in ${CHECK_DIRECTORY}"
    exit 1
fi

echo "New files found: ${files_found}"
exit 0

#!/bin/bash -e

CHECK_DIRECTORY="$1"

if [ ! -d "${CHECK_DIRECTORY}" ]; then
    echo "Not a valid directory: ${CHECK_DIRECTORY}"
    exit 1
fi

files_found=$(find "${CHECK_DIRECTORY}" -mtime -1.125 -type f ! -empty)

if [ "${files_found}" = "" ]; then
    echo "No new files found in ${CHECK_DIRECTORY}"
    exit 1
fi

echo "New files found: ${files_found}"
exit 0

Improve alert behaviour on backup age
Improve alert behaviour on backup age

- Use mtime instead of ctime, this gives the date the backup was
  modified on the *source* box rather than when it was copied onto the
  backups box.

- Allow 1/8th of a day tolerance to allow for the time between the
  backup being created and it being copied over.
