diff options
-rwxr-xr-x | backup-ldap | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/backup-ldap b/backup-ldap index a9d1316..0c8ee63 100755 --- a/backup-ldap +++ b/backup-ldap @@ -12,7 +12,14 @@ umask 022 SLAPCAT="/usr/sbin/slapcat" DATE=`date "+%Y%m%d-%H%M%S"` -TARGET=/var/backups/local/ldap +if [ -d /var/backups/local/ldap ]; then + TARGET=/var/backups/local/ldap +elif [ -d /var/local/backup/ldap ]; then + TARGET=/var/local/backup/ldap +else + echo "Cannot find a backup target directory" >&2 + exit 1 +fi file="$TARGET/$DATE-ldap" $SLAPCAT > "$file" @@ -25,8 +32,3 @@ if [ -e "$TARGET/MD5-$md5" ]; then else ln "$file.bz2" "$TARGET/MD5-$md5" fi - -# clean up old stuff -find "$TARGET" -name 'MD5-*' -links 1 -print0 | xargs --no-run-if-empty rm -- - - |