The "weekly backup script (All DBs)" is composed of 2 shell script.
A first one that is called by the cront
A second one that perform the operation.
For the customization, you need to update the "cron" one and potentially the email notification present in the second shell.
This script save the backup in a subdirectory "weekly" followed by a subdirectory with the name of the day.
So that you have maximum 7 subdirectories (one for each day of the week).
- Download the "backup_alldbs.zip"
- Unzip the files into a directory present on your server and that can be called by cron
We suggest that you create a "backup/cpanel" directory on your server and that you put the script in this directory.
The result of the backup will be stored in directory like
- With a chmod, change the permission of the file to add the "execute" attribute
Most of the parameters are defined in the "backup_alldbs_cron.sh".
This script can do a lot:
- It is possible to send the backup on 1 or 2 FTP account outside the server
- It is also possible to encrypt the compressed file when the FTP is sent on server that you do not control.
- It is possible to send an email notification when the backup is completed.
- It is assumed that the DB is located in the "localhost".
If you want to perform backup from DB that are located on another server, you will have to modify the "mysqldump"
- The DB backup is performed with NO table locking and also ignore the SQL error that would stop the script.
If you want to perform a backup with "table locked", remove the "--lock-tables=false" command in the mysqldump
- We recommand to avoid using special characters in the FTP password.
If you have special character, perhaps you should change the syntax of the LFTP to autorise that.
We have considered that a specific FTP user and FTP password would be used to transfert the backup on another server.
- Avoid using a $ (dollar) character in the DB password.
The $ is generally used in the shell script to identify variable.
The FTP transfert use a "lftp" command.
If this LFTP is not installed on your server, you can use a "yum install lftp".
In case where you have an error on Perl library dependencies error, see also the following article that may help you.
See also the other weekly backup script for single website.