#!/bin/bash
/bin/mount -a;
echo > /var/log/backup_rsync_all
DATE=`date +%Y-%m-%d`
#/bin/date;
#echo "it" && /usr/bin/rsync -a --force --delete --exclude '#recycle' --exclude '*.db' /mnt/datastore1/it/ /mnt/datastore2/it/ && /bin/date
#echo "base1C" && /usr/bin/rsync -a --force --delete --exclude '#recycle' --exclude '*.db' /mnt/datastore1/base1C/ /mnt/datastore2/base1C/ && /bin/date
#echo "obmen" && /usr/bin/rsync -a --force --delete --exclude '#recycle' --exclude '*.db' --exclude 'Buh_scan' /mnt/datastore1/obmen/ /mnt/datastore2/obmen/ && /bin/date
#echo "help" && /usr/bin/rsync -a --force --delete --exclude '#recycle' --exclude '*.db' /mnt/datastore1/help_information/ /mnt/datastore2/help_information/ && /bin/date
#echo "public" && /usr/bin/rsync -a --force --delete --exclude '#recycle' --exclude '*.db' /mnt/datastore1/public/ /mnt/datastore2/public/ && /bin/date
#echo "workgroups" && /usr/bin/rsync -a --force --delete --exclude '#recycle' --exclude '*.db' --exclude 'OLD' /mnt/datastore1/workgroups/ /mnt/datastore2/workgroups/ && /bin/date
#echo "gte10"
#/usr/bin/rsync -a --force --delete --exclude '*.db' '/mnt/gte10/D/Фотобаза/!Фотобаза/Алексей/' '/mnt/datastore1/workgroups/Отдел Рекламы/Сервер/Алексей'
#/usr/bin/rsync -a --force --delete --exclude '*.db' '/mnt/gte10/D/Анастасия/' '/mnt/datastore1/workgroups/Отдел Рекламы/Сервер/Анастасия'
#/usr/bin/rsync -a --force --delete --exclude '*.db' '/mnt/gte10/D/Паспорта/' '/mnt/datastore1/workgroups/Отдел Рекламы/Сервер/Паспорта'
#/usr/bin/rsync -a --force --delete --exclude '*.db' '/mnt/gte10/D/Рабочая РЕКЛАМА/Графика/Упаковка/Маркировка_Соловьев/' '/mnt/datastore1/workgroups/Отдел Рекламы/Сервер/Маркировка_Соловьев'
#/usr/bin/rsync -rv /mnt/datastore2/workgroups /mnt/datastore1/
#echo "server10"
#/bin/date
/usr/bin/rsync -a --force --delete-before --exclude='*Thumbs.db' /mnt/server10/ /mnt/datastore1/backup/windows/server10/latest/
/usr/bin/ssh -i /root/ds1 root@172.16.0.249 "/bin/cp -al /volume1/backup/windows/server10/latest/ /volume1/backup/windows/server10/$DATE"
/usr/bin/rsync -a --force --delete-before --exclude '#recycle' --exclude '*.db' --exclude '#versions' --exclude 'OLD' /mnt/datastore1/workgroups/ /mnt/datastore2/workgroups/
/usr/bin/rsync -a --force --delete-before --exclude '#recycle' --exclude '*.db' --exclude '#versions' /mnt/datastore1/base1C/ /mnt/datastore2/base1C/
/usr/bin/rsync -a --force --delete-before --exclude '#recycle' --exclude '*.db' --exclude '#versions' /mnt/datastore1/help_information/ /mnt/datastore2/help_information/
/usr/bin/rsync -a --force --delete-before --exclude '#recycle' --exclude '*.db' --exclude '#versions' /mnt/datastore1/obmen/ /mnt/datastore2/obmen/
IFS='
'
for file in `/bin/cat /var/log/backup_rsync_all | grep mkstemp | awk -F"\"" '{ print $2 } ' | sed 's/\.[^.]*$//;s;/\.;/;'`;do
file_source=`echo $file | sed 's/datastore2/datastore1/'`
/bin/cp -f "$file_source" "$file"
done
/usr/bin/ssh -i /root/ds2 root@172.16.0.248 "/usr/local/bin/versions.sh"
#echo "/mnt/datastore2/workgroups"
#/bin/date
#/usr/bin/rsync -a --force --delete --exclude='*/#recycle/*' --exclude='*/1100/*' --exclude='*/750/*' --exclude='*/Ульянов А. В/*' --exclude='*Thumbs.db' /mnt/datastore1/workgroups /mnt/datastore2/
#echo "gte111000"
#/usr/bin/rsync -a --force --delete --exclude '*.db' --exclude '$RECYCLE.BIN' --exclude 'System Volume Information' --exclude 'Анастасия' --exclude 'Фотобаза/!Фотобаза/Алексей' --exclude 'Рабочая РЕКЛАМА/Графика/Упаковка/Маркировка_Соловьев' --exclude 'Паспорта' /mnt/gte10/D/ /mnt/datastore1/workgroups/Отдел\ Рекламы/Server/
#/bin/date
#/usr/bin/rsync -a --force --delete --exclude='*/#recycle/*' --exclude='*Thumbs.db' /mnt/gte10/D/* /mnt/datastore2/workgroups/Отдел\ Рекламы/Ульянов\ А.\ В/
#echo "/mnt/datastore1/profs"
#/bin/date
#/usr/bin/rsync -a --delete-after /mnt/datastore1/profs /mnt/datastore2/
for file in `/bin/cat /var/log/backup_rsync_all | grep mkstemp | awk -F"\"" '{ print $2 } ' | sed 's/\.[^.]*$//;s;/\.;/;'`;do
file_source=`echo $file | sed 's/datastore2/datastore1/'`
/bin/cp -f "$file_source" "$file"
done
/usr/bin/ssh -i /root/ds2 root@172.16.0.248 "/usr/local/bin/versions.sh"