Newer
Older
#!/bin/bash
# Copyright © 2019 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
OUTPUT=""
RETURN_CODE="0"
for file in `ls /mnt/vdb/backup/cloud/*.latest`
do
CONTAINER=$(grep "Container:" $file | cut -d ":" -f 2 | tr -d " ")
BYTES=$(grep "Bytes:" $file | cut -d ":" -f 2 | tr -d " ")
OBJECTS=$(grep "Objects:" $file | cut -d ":" -f 2 | tr -d " ")
LAST_FILE=$(tail -2 $file | grep gpg)
if [ `date -d "${LAST_FILE:5:19}" +%s` -gt `date -d '7 days ago' +%s` ]
then
OUTPUT+="OK: Container: $CONTAINER, Size: $BYTES, # Files: $OBJECTS, Last-Modified: ${LAST_FILE:5:19}\n"
OUTPUT+="NOK: Container: $CONTAINER, Size: $BYTES, # Files: $OBJECTS, Last-Modified: ${LAST_FILE:5:19}\n"