#!/bin/bash
source "/etc/scripts/borg.env"

echo "###### Backup started: $(date) ######"

echo "Transfer files ..."
borg create -v --stats --progress \
    $REPOSITORY::'{now:%Y-%m-%d_%H:%M}'  \
    /home                                \
    /root                                \
    /opt                                 \
    /var/www                             \
    /etc/scripts                         \
    /etc/caddy                           \
    /etc/samba                           \
    /etc/wireguard			 \
    /etc/systemd/system/custom*          \


echo "Removing old backups ..."
borg prune -v --list --keep-within=10d $REPOSITORY
borg compact $REPOSITORY

echo "###### Backup ended: $(date) ######"
