#!/bin/bash

	DST="/home/backup/repository"
	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 repository  ${ENV} - ${DATESTART}"  >> ${LOG_BACKUP}/backup_repository_${ENV}.log

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


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

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