From: Frank Brehm Date: Sun, 16 May 2021 20:56:54 +0000 (+0200) Subject: Adding function do_ldap_backup X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=aa60c4b04ca919deb21815a4196265cfdecabc26;p=pixelpark%2Fadmin-tools.git Adding function do_ldap_backup --- diff --git a/bin/manual-backup b/bin/manual-backup index bedff59..f0cad29 100755 --- a/bin/manual-backup +++ b/bin/manual-backup @@ -248,6 +248,12 @@ do_dir_backup() { cd / dir_backup "etc" "etc" dir_backup "root" "root" + if [[ -d "opt/fbrehm" ]] ; then + dir_backup "opt/fbrehm" "opt-fbrehm" + fi + if [[ -d "var/bind" ]] ; then + dir_backup "var/bind" "var-bind" + fi dir_backup "var/lib" "var-lib" dir_backup "var/log" "var-log" dir_backup "var/spool/cron" "var-spool-cron" @@ -388,6 +394,42 @@ do_postgres_backup() { } +#------------------------------------------------------------------------------ +do_backup_ldap() { + + local dumpfile="${BACKUP_DIR}/ldap.dump.ldif.gz" + + if ps -ef | grep slapd | grep -v grep >/dev/null ; then + : + else + debug "OpenLDAP Server is not running." + return + fi + + empty_line + info "Dumping OpenLDAP Datenbank -> '${CYAN}${dumpfile}${NORMAL}' ..." + + local cmd="ldapsearch -D \"${LDAP_DN}\" -x -h localhost" + if [[ "${VERBOSE}" == "y" ]] ; then + cmd+=" --verbose" + fi + cmd+=" -z 10000 -w \"${LDAP_PW}\" -b \"${LDAP_SEARCH_BASE}\"" + cmd+=" | gzip -9" + if [[ "${VERBOSE}" == "y" ]] ; then + cmd+=" --verbose" + fi + cmd+=" > \"${dumpfile}\"" + if [[ "${SIMULATE}" == "y" ]] ; then + info "Executing: ${cmd}" + return + fi + debug "Executing: ${cmd}" + eval ${cmd} + debug "Finished LDAP dump." + +} + + #------------------------------------------------------------------------------ create_checksums() { @@ -513,6 +555,7 @@ main() { if [[ "${DO_POSTGRES}" == "y" ]] ; then do_postgres_backup fi + do_backup_ldap create_checksums clean_old_backups sync_to_remote