examples/migrate-ldif
raw| 1 | #!/bin/bash |
| 2 | |
| 3 | LDIF_DIR=$1 |
| 4 | BKUP_DIR=$2 |
| 5 | |
| 6 | function usage () { |
| 7 | echo "usage: $0 <LDIF_DIR> <BKUP_DIR>" |
| 8 | exit 1 |
| 9 | } |
| 10 | |
| 11 | [[ -d $LDIF_DIR ]] || usage |
| 12 | [[ -d $BKUP_DIR ]] || usage |
| 13 | |
| 14 | for filepath in `ls -1tr $LDIF_DIR/TODO/*.gz` ; do |
| 15 | filename=`basename $filepath` |
| 16 | echo $filename |
| 17 | ldap-git-backup \ |
| 18 | --ldif-cmd "zcat $filepath" \ |
| 19 | --backup-dir $BKUP_DIR \ |
| 20 | --commit-msg $filename \ |
| 21 | --commit-date $filepath |
| 22 | mv $path DONE/$filename |
| 23 | done |