POSTFIX_DIR=/etc/postfix
PF_MAP_DIR="${POSTFIX_DIR}/maps"
+OLDDIR="${PF_MAP_DIR}/old"
RESTART_POSTFIX=
cd ${PF_MAP_DIR} || exit 5
fi
echo "New version of »${FILE_BASE}«, substituting."
- mv "${POSTFIX_FILE}" "${POSTFIX_FILE}.$( date -r ${POSTFIX_FILE} +'%Y-%m-%d_%H:%M:%S' )"
+ if [ ! -d "${OLDDIR}" ] ; then
+ echo "Creating »${OLDDIR}« ..."
+ mkdir -pv "${OLDDIR}"
+ fi
+
+ BAK_FILE="${OLDDIR}/${FILE_BASE}.$( date -r ${POSTFIX_FILE} +'%Y-%m-%d_%H:%M:%S' )"
+
+ mv -v "${POSTFIX_FILE}" "${BAK_FILE}"
mv "${TMP_FILE}" "${POSTFIX_FILE}"
RESTART_POSTFIX=y