bundlewrap/bundles/backup-client/files/check_backup_last_run

29 lines
472 B
Text
Raw Normal View History

#!/bin/bash
statusfile="/var/tmp/backup.monitoring"
if [[ ! -r "$statusfile" ]]
then
echo "cannot read $statusfile"
exit 3
fi
. "$statusfile"
if [[ -z "$msg" ]] || [[ -z "$status" ]] || [[ -z "$timestamp" ]]
then
echo "status file is corrupt, cannot read status"
exit 3
fi
two_days_ago=$(($(date +%s) - 86400*2))
if [[ $timestamp -lt $two_days_ago ]]
then
echo "last saved status is older than two days"
exit 2
fi
echo "$msg"
exit "$status"