Using the script provided below you will be able to make automatic full cPanel backups of your account.
This backup script includes SSL support. This is not necessary if you run the script on the server for which you are generating the backup; but the SSL support could be important if you are running the script somewhere else to connect to your cPanel hosting account.
NOTE 1: Make sure to replace cPanel user and password with your own details.
NOTE 2: If you do not use FTP upload, set $ftp to false ($ftp = false)
To schedule the script to run regularly, save it as fullbackup.php in your home directory and add a new cron job with the following syntax:
00 2 * * 1 /usr/local/bin/php /home/youraccount/fullbackup.php
(Runs every Monday night at 2:00 a.m.)
NOTE 1: In order to exclude the backups folder from automatic backup generation (if your account is a couple GBs big, disk space usage will increase drastically, as every new backup will contain all the former ones), look for the cpbackup-exclude.conf file in the home directory, add the folder name and use an asterisk * after the directory if you want to exclude all the files from a directory, or add the path to the file you wish to exclude from backups then and save the changes:
NOTE 2: If your account is hosted on a shared server, make sure that your script usage is optimized in order not to overload the server.
NOTE 3: We do not provide code debugging services. This script is provided as a matter of courtesy for your convenience only.