Tag Archives: backup

Автор:Dmitriy Altuhov

1c 8.2 postgresql server backup sql bat windows

Имеется сервер ubuntu с установленным сервером 1С и БД Postgresql.
Имеется сервер windows 2008 R2.

Задача. Организовать автоматическое резервное копирование базы 1С из postgresql (с сервера 1С) на сервер Windows 2008 R2. Средствами pg_dump. С сохранением последних 7-и архивов.

@echo off & setLocal EnableDelayedExpansion
for /f "skip=14 tokens=* delims= " %%a in ('dir/b/o-d C:\WORK\backupALL\buhgaltery\*.zip') do (
del "C:\WORK\backupALL\buhgaltery\%%a"
)
for /f "skip=21 tokens=* delims= " %%a in ('dir/b/o-d C:\WORK\backupPG1C\*.backup') do (
del "C:\WORK\backupPG1C\%%a"
)
for /f "tokens=1-2 delims=:" %%a in ('echo %time%') do set hhmm=%%a%%b
for /f "tokens=1-3 delims=." %%D in ('echo %DATE%') do set yyyymmdd=%%F%%E%%D
set BACKUP_FILE=C:\WORK\backupPG1C\UPP_%yyyymmdd%_%hhmm%.backup
echo backup file name is %BACKUP_FILE%
SET PGPASSWORD=password
echo on
"C:\Program Files\PostgreSQL\9.2.4-1.1C\bin\pg_dump.exe" --host server1c --port 5432 --username "postgres" --no-password --format custom --blobs --file %BACKUP_FILE% "upp"
@echo off
set BACKUP_FILE=C:\WORK\backupPG1C\APROIZV_%yyyymmdd%_%hhmm%.backup
echo backup file name is %BACKUP_FILE%
SET PGPASSWORD=password
echo on
"C:\Program Files\PostgreSQL\9.2.4-1.1C\bin\pg_dump.exe" --host server1c --port 5432 --username "postgres" --no-password --format custom --blobs --file %BACKUP_FILE% "aproizv"
@echo off
set BACKUP_FILE=C:\WORK\backupPG1C\7PROIZV_%yyyymmdd%_%hhmm%.backup
echo backup file name is %BACKUP_FILE%
echo on
"c:\Program Files\7-zip\7z.exe" a -t7z -ssw -mx3 -r %BACKUP_FILE% D:\share\1CBases
@echo off

Автор:Dmitriy Altuhov

linux tar backup script 1c bases

#!/bin/sh

if [ $(ls /backup/*.backup | wc -l) -gt 10 ]
then
find /backup/*.backup -mtime +10 -delete 2>/dev/null > /dev/null
fi
backup_source=»/media/disk1c/1с/»
backup_dest=»/backup»
date=`date +%Y.%m.%d_%H_%M`
hostname=1cbases
filename=»$hostname-$date.backup»
echo «Backing Up your Linux System»
tar cvpzf   $backup_dest/$filename  $backup_source
echo «Backup finished»
Автор:Dmitriy Altuhov

linux backup script mysql gzip dump

#!/bin/sh

mount /dev/sdb1 /mnt/sdb1

if [ $(ls /mnt/sdb1/backup/*.dump.gz | wc -l) -gt 8 ]
then
  find /mnt/sdb1/backup/*.dump.gz -mtime +8 -delete 2>/dev/null > /dev/null
fi
DIR=»/mnt/sdb1/backup»
#mkdir -p $DIR
#LOG=»/backup/log/log.log»
#touch $LOG
TIMENAME=`date +%d.%m.%Y-%H.%M`
db=`mysql -u root -h localhost -pPASS -Bse ‘show databases’`
for n in $db; do
#TIMEDUMP=`date ‘+%T %x’`
#echo «backup has been done at $TIMEDUMP : $TIMENAME on db: $n» >> $LOG
mysqldump -u root -h localhost -pPASS $n | gzip -c > «$DIR/mysql-$n-$TIMENAME-db.dump.gz»
done
umount /mnt/sdb1