Nova Resource:Tools/Admin/toolhistory

From Wikitech
  1. !/bin/bash
  1. Dump and commit the list of servicegroups to the repository at
  2. ~/var/lib/git/servicegroups hourly for backup and history.
  1. Abort on error.

set -e

  1. Loop forever.

while true; do

   TMPWC="$(mktemp -d)"
   git clone ~/var/lib/git/servicegroups "$TMPWC"
   cd "$TMPWC"
   ldaplist -l servicegroups > servicegroups.ldif
   git add servicegroups.ldif
   if git commit -m Snapshot; then
       git push
   fi
   cd
   rm -Rf "$TMPWC"
   # Sleep for an hour.
   sleep 1h

done