bundlewrap/bundles/backup-client/files/check_backup_last_run
Franziska Kunsmann 14e4415e5f
All checks were successful
kunsi/bundlewrap/pipeline/head This commit looks good
bundles/backup-client: rework backup generation
2022-01-07 08:29:34 +01:00

28 lines
472 B
Bash

#!/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"