make btrbk failures higher priority
[distro-setup] / check-radicale
1 #!/bin/bash
2
3 if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi
4 source /a/bin/errhandle/err
5
6 source /a/bin/bash_unpublished/source-state
7 if [[ $HOSTNAME != "$MAIL_HOST" ]]; then
8 exit 0
9 fi
10
11 # i had a phone which deleted all my contacts in radicale, but kept them
12 # locally. then the phone died months later, and i had no backup of
13 # recent contacts. This checks that those files didnt get deleted or
14 # zerod out, by picking an amount that we dont expect to go below
15 # anytime soon as of 2022.
16
17 count=$(find /o/radicale/collections -type f | grep -v cache | wc -l)
18
19 if (( count < 220 )); then
20 echo "unexpected file count=$count < 220"
21 fi
22
23 size=$(du -s /o/radicale | awk '{print $1}')
24
25 if (( size < 2000 )); then
26 echo "unexpected kb size=$size < 2000"
27 fi