Резервное копирование

All English-language materials have been translated fully automatically using the Google service

Regular automatic site backup based on bash script

The script performs regular automatic creation of a database dump at the root of the site, archiving all files and then deleting the dump from the root


# Number of days to keep copies

# Path to the folder with files for storing copy files

# Site directory name

# Database name

# Password to access the database

d=`date +%F-%H:%M:%S`
mkdir -p $backup_dir 2>/dev/null

# Deleting old copy files
find $backup_dir -name "*autobackup.tar.gz" -type f -mtime +$days -delete

# Database dump
mysqldump -h localhost -u$db_name $db_name -p"$db_pass" > $dump_name

# Archiving files
tar cvvzf "$backup_dir/YOUR_SITE_NAME-$d-autobackup.tar.gz" $site_dir --exclude=bitrix/cache --exclude=bitrix/backup

# Remove the dump from the site root
rm $dump_name

This archive can be automatically saved to Yandex disk. You can implement this by adding the command to the end of the script:

curl -T "$backup_dir/YOUR_SITE_NAME-$d-autobackup.tar.gz" -u"YANDEX_USER_LOGIN:YANDEX_USER_PASSWORD"

Save the script in any folder on your account with the extension .sh and give the file execution permissions with the following command:

chmod u+x

Add this file to the crowns with a command like this

*/1 * */14 * * /bin/bash ~/

The solution is provided "as is". Use it at your own risk

Automatic site backup to Yandex.Disk

Original solution here

For automatic copying, install an unofficial client from Anton Batenev

git clone
sudo cp ydcmd/ /usr/local/bin/ydcmd
yum install python-dateutil

Getting a token for working through the API

ydcmd token

A link will be sent as a response, by clicking on which you will receive a confirmation code. To get a token, copy the received code and run like this:


Create a .ydcmd.cfg file in the user folder with 0400 rights and content

token = РАНЕЕ-ПОЛУЧЕННЫЙ-OAuth token-
verbose = yes

It remains only to add the cron command

10 1 * * * root /usr/local/bin/ydcmd put --rsync /home/bitrix/www/bitrix/backup disk:/YANDEX_DISK_ACCOUNT_EMAIL

Manual unpacking of a multi-volume Bitrix backup

If the Bitrix archive was compressed without using encryption, then it can be unpacked. To do this, you will need to change the extensions of all parts of the archive

.tar.gz to .tar.gz.001 for the first file

.tar.gz.1 to .tar.gz.002 
.tar.gz.2 to .tar.gz.003 etc. for everyone else

You can then unpack it like a normal multi-volume archive.


There are no comments yet, you can be the first to leave it

Leave a comment

The site uses a comment pre-moderation system, so your message will be published only after approval by the moderator

You are replying to a user's comment



Email me

Are you developing a new service, making improvements to the existing one and want to be better than your competitors? You have come to the right place. I offer you a comprehensive studio-level website development. From me you can order design, layout, programming, development of non-traditional functionality, implementation of communication between CMS, CRM and Data Analitics, as well as everything else related to sites, except for promotion.

Contact, I will always advise on all questions and help you find the most effective solution for your business. I am engaged in the creation of sites in Novosibirsk and in other regions of Russia, I also work with the CIS countries. You will be satisfied with our cooperation

An error occurred while sending, please try again after a while
Message sent successfully


+7(993) 007-18-96



Россия, г. Москва

By submitting the form, you automatically confirm that you have read and accept the Privacy Policy site

Contact with me
Send message
By submitting the form, you automatically confirm that you have read and accept Privacy policy of site
Sending successful!
Thank you for contacting :) I will contact you as soon as possible
Sending failed
An error occurred while sending the request. Please wait and try again after a while or call my phone number