Скрипт для быкапов

30.08.2018 - Записи в блоге

#!/bin/bash

echo '' >> /var/log/backup.log
ts=`date +"%Y-%m-%d"`
echo `date '+%Y-%m-%d %H:%M:%S'` Run backup script >> /var/log/backup.log

echo `date'+%Y-%m-%d %H:%M:%S'` Backup ZUP to /backup/daily/zup$ts.zip >> /var/log/backup.log
/usr/bin/zip -r9 "/backup/daily/zup$ts.zip" /mnt/1c-bases/ZUP
echo `date '+%Y-%m-%d %H:%M:%S'` `du -h /backup/daily/zup$ts.zip` >> /var/log/backup.log

echo `date '+%Y-%m-%d %H:%M:%S'` Backup BP to /backup/daily/bp$ts.zip >> /var/log/backup.log
/usr/bin/zip -r9 "/backup/daily/bp$ts.zip" /mnt/1c-bases/BP
echo `date '+%Y-%m-%d %H:%M:%S'` `du -h /backup/daily/bp$ts.zip` >> /var/log/backup.log

echo `date '+%Y-%m-%d %H:%M:%S'` Replication to 1c-bases /mnt/1c-bases/archive/ >> /var/log/backup.log
/bin/cp /backup/daily/zup$ts.zip /mnt/1c-bases/archive/
/bin/cp /backup/daily/bp$ts.zip /mnt/1c-bases/archive/

echo `date '+%Y-%m-%d %H:%M:%S'` Replication to external HDD /backup/external/ >> /var/log/backup.log
/bin/cp /backup/daily/zup$ts.zip /backup/external/
/bin/cp /backup/daily/bp$ts.zip /backup/external/

find /backup/daily/ -mtime +35 -exec rm {} \;
find /mnt/1c-bases/archive/ -mtime +5 -exec rm {} \;

echo `date '+%Y-%m-%d %H:%M:%S'` Complete >> /var/log/backup.log

› tags: bash / zip / Резервное копирование /