Following on from our previous post (https://www.linuxtutorial.co.uk/cpanel-mysql-backup-script/) there is another script for the full backup of CPanel web directories.
The original post is taken from http://r00t3r.com/cpanel-full-backup-cron-script-for-automated-backups/ which contains a link to download the PHP files.
The main file to worry about is the config.php which contains a cpanel section:
// CPANEL ACCOUNT TO BACKUP define( 'CPANEL_SERVER_ADDRESS', 'abc.def.ghj.mnp' ); // IP address or domain name for the server with the cPanel account define( 'CPANEL_PORT_NUM', '2083' ); // The port number for the cPanel. If you have problems, try 2082 define( 'CPANEL_ADMIN_USERNAME', 'admin-username' ); // the admin username for your cPanel account define( 'CPANEL_ADMIN_PASSWORD', 'veryStrongPassword' ); // the admin password for your cPanel account
and the FTP server section:
define( 'FTP_SERVER_ADDRESS', 'npq.rst.uvw.xyz' ); // IP address or URL of the FTP server define( 'FTP_SERVER_PORT', '21' ); // FTP(S) Port. Default is 21. define( 'FTP_USERNAME', 'ftp-username' ); // FTP Username define( 'FTP_PASSWORD', 'ftp-password' ); // FTP Password define( 'FTP_PATH_TO_COPY', '/ftp/path/to/copy/' ); // FTP Path (where do you want to copy the files?)
Simply enter in your CPanel and FTP server account details to this PHP script.
Once in place setup the cron job to run on a regular basis e.g.
1 1 * * * php -q /home/user/path_to_phpscript/cpanelbackup.php
Recent Comments