22 lines
537 B
Bash
Executable File
22 lines
537 B
Bash
Executable File
#!/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}"
|
|
|
|
# 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
|
|
|