35 lines
548 B
Bash
Executable file
35 lines
548 B
Bash
Executable file
#!/usr/bin/env sh
|
|
|
|
set -e
|
|
|
|
_hostname="$(cat /proc/sys/kernel/hostname)"
|
|
_host_backup_file="host-backup-$_hostname"
|
|
if [ -x "$( which "$_host_backup_file")" ]
|
|
then
|
|
# shellcheck disable=SC1090
|
|
. "$_host_backup_file"
|
|
else
|
|
echo "No host-backup file found: $_host_backup_file"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "$1" ]
|
|
then
|
|
host_backup_run
|
|
exit 0
|
|
fi
|
|
|
|
case "$1" in
|
|
"_forget")
|
|
host-backup forget --prune --group-by "host" \
|
|
--keep-last 7 \
|
|
--keep-daily 14 \
|
|
--keep-weekly 12 \
|
|
--keep-monthly 12 \
|
|
--keep-yearly 2
|
|
;;
|
|
*)
|
|
restic "$@"
|
|
;;
|
|
esac
|
|
|