#!/bin/bash

# Set the paths for the source and destination directories
SRC="/home/belar/.config"
DST_DIR=/mnt/nas_belar/rsync/config-backup/

# Sync the source directory to the destination directory
#/usr/bin/rsync -CERrltm --delete "${SRC}" "${DST_DIR}"
/usr/bin/rsync -CERrltm --delete "${SRC}" truenas-belar:/mnt/DATA/USER_DATA/belar/rsync


# Change to the Git repository directory
cd $DST_DIR

# Commit the changes with the current date as the commit message
git add .
git commit -m "$(date +%Y-%m-%d-%H-%M)"

# Push the changes to the remote repository if one is configured
if [ "$(git remote)" ]; then
    git push
fi

