Skip to content

Instantly share code, notes, and snippets.

@HeinrichHartmann
Last active January 1, 2016 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HeinrichHartmann/8161357 to your computer and use it in GitHub Desktop.
Save HeinrichHartmann/8161357 to your computer and use it in GitHub Desktop.
Monitor /etc/ using git

Monitor /etc/ using git

  1. Initialize a new git repository at /etc/

     cd /etc/
     sudo git init
    
  2. Setup .gitignore

     cat << EOF | sudo tee .gitignore
     ld.so.cache
     ld.so.conf
     mtab
     group-
     gshadow-
     passwd-
     shadow-
     EOF
    
  3. Make initial commit

     sudo git add .
     sudo git commit -m "initial commit"
    
  4. Setup hourly commits using crontab:

     sudo crontab -e
    

    and add the following line

     0 * * * * cd /etc/ && git add . && git commit -a -m "hourly commit" 2>&1 >> /var/log/cron.log
    

    Use tail -f /var/log/cron.log and tail -f /var/log/syslog | grep CRON to monitor cron activities.

  5. Use sudo gitg to review/undo changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment