Knowledgebase
[How To] Run Automated cPanel Account Backups using CRON
| Often you may wish to keep backups of your account for safe keeping, and cPanel allows this to be done easily, however it does not allow you to schedule automatic backups, this script will allow you to do just that!
<?php // PHP script to allow periodic cPanel backups automatically, optionally to a remote FTP server. // ********* THE FOLLOWING ITEMS NEED TO BE CONFIGURED ********* // Info required for cPanel access // Info required for FTP host // Notification information // Secure or non-secure mode // Set to 1 to have web page result appear in your cron log // *********** NO CONFIGURATION ITEMS BELOW THIS LINE ********* if ($secure) { $socket = fsockopen($url,$port); // Encode authentication string $params = "dest=$ftpmode&email=$notifyemail&server=$ftphost&user=$ftpuser&pass=$ftppass&submit=Generate Backup"; // Make POST to cPanel // Grab response even if we don't do anything with it. fclose($socket); ?> To schedule the script to run regularly, save it as fullbackup.php in your top directory (not /public_html, which would be less secure), and enter a new cron job like the following: 15 2 * * * php /home/Username/fullbackup.php
(Runs every night at 2:15 a.m.) or 15 2 * * 1 php /home/youraccount/fullbackup.php
(Runs every Sunday night at 2:15 a.m.) NOTES: - Orginal Script Copyright Jason-Cook.com - You should be aware that account back ups run too close together can have an adverse affect on server resources, account back up's ideally should be run 6 or more hours apart at off-peak times (in the early hours of the morning). |
Powered by WHMCompleteSolution
Client Login
Contact Us
System Status
Blog
Affiliates
Knowledge Base

