2022-01-07 07:29:34 +00:00
|
|
|
#!/bin/bash
|
2021-01-01 12:59:42 +00:00
|
|
|
|
2022-01-07 07:29:34 +00:00
|
|
|
statusfile="/var/tmp/backup.monitoring"
|
2021-01-01 12:59:42 +00:00
|
|
|
|
2022-01-07 07:29:34 +00:00
|
|
|
if [[ ! -r "$statusfile" ]]
|
|
|
|
then
|
|
|
|
echo "cannot read $statusfile"
|
|
|
|
exit 3
|
|
|
|
fi
|
2021-01-01 12:59:42 +00:00
|
|
|
|
2022-01-07 07:29:34 +00:00
|
|
|
. "$statusfile"
|
2021-01-01 12:59:42 +00:00
|
|
|
|
2022-01-07 07:29:34 +00:00
|
|
|
if [[ -z "$msg" ]] || [[ -z "$status" ]] || [[ -z "$timestamp" ]]
|
|
|
|
then
|
|
|
|
echo "status file is corrupt, cannot read status"
|
|
|
|
exit 3
|
|
|
|
fi
|
2021-01-01 12:59:42 +00:00
|
|
|
|
2022-01-07 07:29:34 +00:00
|
|
|
two_days_ago=$(($(date +%s) - 86400*2))
|
2021-01-01 12:59:42 +00:00
|
|
|
|
2022-01-07 07:29:34 +00:00
|
|
|
if [[ $timestamp -lt $two_days_ago ]]
|
|
|
|
then
|
|
|
|
echo "last saved status is older than two days"
|
|
|
|
exit 2
|
|
|
|
fi
|
2021-08-01 05:57:22 +00:00
|
|
|
|
2022-01-07 07:29:34 +00:00
|
|
|
echo "$msg"
|
|
|
|
exit "$status"
|