主题: LDAP备份脚本backup_openldap.sh 出现错误1
我在使用iRedMail系统提供的backup_openldap.sh 执行cron制动备份脚本的时候提示:/opt/backuptools/backup_openldap.sh: line 137: slapcat: command not found* Compressing LDIF file ...这是怎么回事。我发现出现错误,系统仍然有成功备份的LDAP的文件。该如何解决呀?请大家帮忙分析一下。下面是出错的位置。
 85 #########################################################
 86 # You do *NOT* need to modify below lines.
 87 #########################################################
 88 # Commands.
 89 CMD_DATE='/bin/date'
 90 CMD_DU='du -sh'
 91 CMD_COMPRESS='bzip2 -9'
 92
 93 if [ -f /etc/ldap/slapd.conf ]; then
 94     CMD_SLAPCAT='slapcat -f /etc/ldap/slapd.conf'
 95 elif [ -f /etc/openldap/slapd.conf ]; then
 96     CMD_SLAPCAT='slapcat -f /etc/openldap/slapd.conf'
 97 elif [ -f /usr/local/etc/openldap/slapd.conf ]; then
 98     CMD_SLAPCAT='slapcat -f /usr/local/etc/openldap/slapd.conf'
 99 else
100     CMD_SLAPCAT='slapcat'
101 fi
102132 ##############
133 # Backing up
134 #
135
136 echo "* Dumping LDAP data into file: ${BACKUP_FILE}..." >>${LOGFILE}
137 ${CMD_SLAPCAT} > ${BACKUP_FILE}
138
139 # Compress plain SQL file.
140 if [ X"${COMPRESS}" == X"YES" ]; then
141     echo -n "* Compressing LDIF file ..."
142     ${CMD_COMPRESS} ${BACKUP_FILE} >>${LOGFILE} 2>&1
143
144     if [ X"$?" == X"0" ]; then
145         echo -e "\tDone" >>${LOGFILE}
146
147         # Delete plain LDIF file after compressed.
148         if [ X"${DELETE_PLAIN_LDIF_FILE}" == X"YES" -a -f ${BACKUP_FILE} ]; t    hen
149             echo -n "* Removing plain LDIF file: ${BACKUP_FILE}..." >>${LOGFI    LE}
150             rm -f ${BACKUP_DIR}/*.ldif >>${LOGFILE} 2>&1
151             [ X"$?" == X"0" ] && echo -e "\tDone" >>${LOGFILE}
152         fi
153     fi
154 fi
155
156