#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail

MIRROR_DIR="/home/backup/mirror/$(date +%Y%m)"
MIRROR_CHECK_DIR="/home/backup/mirror/$(date -d "-6 month" +%Y%m)"

if [ ! -d "${MIRROR_DIR}" ]
then
	mkdir -p "${MIRROR_DIR}"
fi
if [ -d "${MIRROR_CHECK_DIR}" ] 
then
	rm -rf "${MIRROR_CHECK_DIR}"
fi
cp -R /home/backup/compress/* /home/backup/mirror/$(date +%Y%m) 
#lftp -c "open -u webbackup,iact2022\!@ 175.120.29.134 -p 1021; mirror -R /home/backup/mirror/ /webbackup/177server"
lftp -c "open -u webbackup,iact2022\!@ 10.1.4.2 -p 1021; mirror -R /home/backup/mirror/ /webbackup/177server"
