Monday, July 21, 2008

/etc git snapshots with php

Read the main article with general idea http://www.jukie.net/~bart/blog/20070312134706

I have wrote an small php script for daily snapshots for /etc

Here how i use it on an nacked sistem


1.install git
apt-get install git-core
2. initialize /etc to be a git repo
cd /etc
git init-db
chmod og-rwx .git
3.ignore a few files
cat > .gitignore
*~
*.dpkg-new
*.dpkg-old
4.commit the current state
git add .
git commit -a -m"initial import"


then you can add an daily snapshot script or an after upgrade one (after dist-upgrade)

./git-snapshot-script.php

You can check the /etc status with

$sudo git status

in my case was

# On branch master
# Changed but not updated:
# (use "git add ..." to update what will be committed)
#
# modified: php5/cli/php.ini
#
no changes added to commit (use "git add" and/or "git commit -a")
so i have made a new snapshot
./git-snapshot-script.php
/etc Backup for Mon Jul 21 18:51:19 EEST 2008Created commit a2b9112: snapshot Mon Jul 21 18:51:19 EEST 2008
1 files changed, 1 insertions(+), 1 deletions(-)

No comments: