Skip to content

Instantly share code, notes, and snippets.

@dmitriysafronov
Last active July 18, 2022 20:57
Show Gist options
  • Save dmitriysafronov/d4d6d8b4b90eee8f882a1b6983a5099d to your computer and use it in GitHub Desktop.
Save dmitriysafronov/d4d6d8b4b90eee8f882a1b6983a5099d to your computer and use it in GitHub Desktop.
Git backup monitor with [/root/.profile] snippet and [/etc/cron.daily/backup-addins] file and default [/.gitignore]
# Exclude all
/*
# but essential directories and files
!/.gitignore
!/README.md
#######################################
#######################################
# /usr directory
!/usr
/usr/*
## /usr/local directory
!/usr/local
#######################################
# /root directory
!/root
/root/*
## root files
!/root/.bashrc
!/root/.bash_logout
!/root/.gitconfig
!/root/.profile
!/root/.selected_editor
/root/.ssh/*.old
/root/.ssh/id_*
!/root/.ssh
# GIT addon(s)
if [ -n "$(which git)" ]; then
if [ -n "$(git -C / status -s)" ]; then
echo "There are updates in '/', you can backup them manually with [/etc/cron.daily/backup-additions]!"
git -C / status -s
fi
if [ -n "$(git -C /etc status -s)" ]; then
echo "There are updates in '/etc', you can backup them manually with [/etc/cron.daily/etckeeper]!"
git -C /etc status -s
fi
fi
#!/usr/bin/env sh
git -C / add -A && git -C / commit -m "$(date +'%Y/%m/%d %H:%M:%S %:z')" && git -C / push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment