Franziska Kunsmann
14e4415e5f
All checks were successful
kunsi/bundlewrap/pipeline/head This commit looks good
28 lines
472 B
Bash
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"
|