blob: 48a8a3ee4344e80cda8e57bb78667944d04f61a5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/bin/bash
uuid=05b7770e-1f01-4b17-83de-ede0a04495a1
instance="$(systemd-escape $uuid)"
if systemctl --quiet is-active "cryo@$instance.service"; then
echo ""
echo "backup running"
echo "#00ff00"
elif systemctl --quiet is-failed "cryo@$instance.service"; then
echo ""
echo "backup failed"
echo "#ff0000"
elif [[ -f /var/lib/cryo/$uuid/alpha ]]; then
last_run=$(date --reference "/var/lib/cryo/$uuid/alpha" +%s)
now=$(date +%s)
days=$(( (now - last_run) / 60 / 60 / 24 ))
if [[ $days -gt 30 ]]; then
echo ">30d"
echo "backup last run over 30 days ago"
echo "#ff0000"
else
echo "${days}d"
echo "backup last run $days days ago"
fi
else
echo "no backup"
echo "no recent backup found"
fi
|