From 77e70062d80cbec1cedf4e97cde373b53bf5ca75 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Sat, 29 Jun 2013 09:02:55 +0200 Subject: [PATCH] Current state --- postfix/get-checks-from-postfixbuch.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/postfix/get-checks-from-postfixbuch.sh b/postfix/get-checks-from-postfixbuch.sh index 30955dd..0c04f52 100755 --- a/postfix/get-checks-from-postfixbuch.sh +++ b/postfix/get-checks-from-postfixbuch.sh @@ -7,6 +7,7 @@ echo "[$( date )]: Checking for new versions of postfix checkfiles from »${BASE POSTFIX_DIR=/etc/postfix PF_MAP_DIR="${POSTFIX_DIR}/maps" +OLDDIR="${PF_MAP_DIR}/old" RESTART_POSTFIX= cd ${PF_MAP_DIR} || exit 5 @@ -37,7 +38,14 @@ for FILE_BASE in body_checks header_checks; do 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 -- 2.39.5