#!/bin/bash
[[ ! -d /var/lib/backuppc/pc ]] && echo "BackupPC directory not found (/var/lib/backuppc/pc)." && exit 1
if ! cd "/var/lib/backuppc/pc"; then
echo "Failed to enter in BackupPC directory (/var/lib/backuppc/pc)."
exit 1
fi
OUT="
Host |
Nb backups |
Before V4 |
After V4 |
"
t_v3=0
t_v4=0
for h in *; do
if [[ ! -d "$h" ]] || [[ ! -e "$h/backups" ]]; then
continue
fi
vers=$( cut -f24 < "$h/backups" )
v3=$( grep -Evc '^4' <<< "$vers" )
((t_v3=t_v3+v3))
[[ "$v3" -ne 0 ]] && v3="$v3"
v4=$( grep -Ec '^4' <<< "$vers" )
((t_v4=t_v4+v4))
OUT="$OUT$h | $v3 | $v4 |
"
done
[[ $t_v3 -gt 0 ]] && t_v3="$t_v3"
OUT="$OUT
Total : |
$t_v3 |
$t_v4 |
"
lynx -stdin <<< "$OUT"
# vim:set sw=4 ts=4 sts=4 ft=bash expandtab: