#!/bin/bash


	DST="/home/backup/maildir"
	LOG_BACKUP="/var/log/backup_edokumenty"
	ENV="edokumenty"

	DATESTART=$(date +"%Y-%m-%d %H:%M:%S")

	mkdir -p ${LOG_BACKUP}
	
	if [ -d $DST ] 
	then
		sleep 1
		else
			mkdir $DST
			fi

	echo "Start: Backup maildir  ${ENV} - ${DATESTART}"  >> ${LOG_BACKUP}/backup_maildir_${ENV}.log

		rsync -a /home/${ENV}/maildir/ ${DST}

	DATEEND=$(date +"%Y-%m-%d %H:%M:%S")

	echo "Koniec: Backup maildir ${ENV} - ${DATEEND}" >> ${LOG_BACKUP}/backup_maildir_${ENV}.log
