Code Monkey home page Code Monkey logo

simplify's People

Contributors

ehrenfeu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

simplify's Issues

Add documentation how to set up autogit.

Auto-tracking changes in a directory

Simple shell script to automatically track changes in a directory tree.

The script was written and successfully tested on many hosts to track changes in /etc - please be aware that pushing the repo to a public git hosting service will reveal highly sensitive security information about the installation!

Setup

First, clone the repository containing this script. The proposed location is /opt (otherwise you have to adjust the cronjob, see below):

cd /opt
git clone http://github.com/ehrenfeu/simplify.git

Next, initialize the repo for the directory tree you'd like to track (/etc in this case), make sure only root can access the repository (so you don't accidentially leak the files to a regular user), add the ignores and configure git for the root user:

cd /etc
cp -v /opt/simplify/autogit/gitignore.etc .gitignore
git init
chmod go-rx .git
git add .
git config --global user.name "root (${HOSTNAME})" 
git config --global user.email "root@${HOSTNAME}" 
git commit -a -m "initial import of /etc on host '${HOSTNAME}'" 

Finally, install and configure the cronjob that auto-commits all changes (adjust the cronjob-file to configure who will receive notification emails, where to find the "autogit" script and how often to run it):

cd /etc/cron.d/
cp -v /opt/simplify/autogit/cronjob.autogit-etc autogit-etc
vim autogit-etc
git add autogit-etc
git commit -m "add cronjob" 

Optionally (but recommended) configure a remote repository to auto-push the changes. As mentioned, DO NOT USE a public service like github here, as this will compromise highly sensitive data:

git remote add origin git-repo-hosting-machine:etc-${HOSTNAME}.git
git push --all

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.