Created
May 7, 2016 08:50
-
-
Save holly/6fa71edb6416b2d6f4846b42883b0d18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| BACKUP_DIR=/backup/openldap | |
| ROTATE=7 | |
| if [ ! -d $BACKUP_DIR ]; then | |
| mkdir -p $BACKUP_DIR | |
| fi | |
| day=$(date '+%Y%m%d') | |
| slapcat -b cn=config | gzip -c >$BACKUP_DIR/openldap-config-$day.ldif.gz | |
| slapcat | gzip -c >$BACKUP_DIR/openldap-$day.ldif.gz | |
| find $BACKUP_DIR -type f -mtime +$(($ROTATE - 1)) | xargs rm -vf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment