====== etckeeper ======
==== Konfiguracia ====
* upravit /etc/etckeeper/etckeeper.conf
VCS="git"
AVOID_DAILY_AUTOCOMMITS=1
AVOID_COMMIT_BEFORE_INSTALL=1
* inicializácia
# etckeeper init
# etckeeper commit -m "Init"
* commit-hook pre zasielanie zmien emailom /etc/.git/hooks/post-commit
#!/bin/bash
# Send email on commit.
HOSTNAME=`hostname -f`
EMAIL="admin@initipi.sk"
SUBJECT=$(git log -n 1 --pretty=%s)
git log -n 1 -p | mail -s "Z: $HOSTNAME: $SUBJECT" $EMAIL
# chmod +x /etc/.git/hooks/post-commit
* na kontrolu nekomitnutych zmien treba vytvorit CRON job /etc/cron.d/info-uncommited_changes-etc:
0 3 * * * root /usr/local/bin/info-uncommited_changes-etc.sh >/dev/null
* a skript /usr/local/bin/info-uncommited_changes-etc.sh:
#!/bin/bash
#
# This script send status of 'etckeeper'.
#
MAIL_TO=admin@initipi.sk
MAIL_CC=
HOST=$(hostname -f)
CHANGES=/var/tmp/info-uncommited_changes-etc.$$
cd /etc || exit 1
if [ ! -d .git ]; then
exit 2;
fi
if git status -s | grep -q '.*'; then
echo "### GIT STATUS ###" >> $CHANGES
echo >> $CHANGES
git status -s >> $CHANGES;
fi
if git status -s | grep -q '^ M'; then
echo >> $CHANGES
echo "### GIT DIFF ###" >> $CHANGES
echo >> $CHANGES
git diff >> $CHANGES;
fi
if [ -f "$CHANGES" ]; then
mail -s "I: $HOST - uncommited changes in /etc" $MAIL_TO < $CHANGES;
fi
rm -f $CHANGES
# chmod +x /usr/local/bin/info-uncommited_changes-etc.sh