CP-ASB (cPanel Automated System Backup) automated full Backups daily with a Cron task and upload it to a remote FTP using orginize folder structure by days,months and years.
cPanel is a control panel base on Linux designed to simplify the process of hosting a web site. Most of professional web hosting provide cPanel. CP-ASB can be used with all of then that use cPanel API 1. Some of providers are GoDaddy, blueHost, unitedHosting, HostGator, resellerclub, etc.
Developed in PHP scripting language.
Version 1.2.1 - Released 04.01.2020 - ChangeLog
- xmlapi to connect with cPanel's XML-API.
- FullBackup from cPanel (mySQL, data, emails, configuration...)
- Remote FTP upload to a server when cPanel backup finish
- Automated directory structure for Daily backup
- Automated directory structure for Monthly backup
- Automated directory structure for Yearly backup
- Automated backup delete when reach file limit for Daily Directory
- Configure the defaults settings for FTP and cPanel accounts. Editing config.php file:
EMAIL_NOTIFICATION
Notification email for finish backupBACKUP_DAILY_LIMIT
Number of store backups in daily directoryFTP_HOST
FTP remote IP or domainFTP_PORT
FTP remote PortFTP_USER
FTP user accountFTP_PASS
FTP password accountFTP_ROOT_PATH
FTP path where deploy directory structureFTP_DAILY_DIRNAME
Store daily BackupsFTP_MONTHLY_DIRNAME
Store Monthly backupsFTP_YEARLY_DIRNAME
Store Yearly backupsCPANEL_HOST
cPanel Server IP or domain name (cpanel.domain.com)CPANEL_USER
cPanel User AccountCPANEL_PASS
cPanel Password AccountDEBUG
Enable Debug Mode
- Upload index.php and lib folder to your web hosting.
- Configure a cron task in your web hosting to run index.php script every day.
- There is new cPanel API 2 but it hasn't got backup Feature, so I use API 1 to do it.
- The day 1 of each month, last done backup will move to Monthly Directory. I do that because FTP protocol don't allow
copy
commands from FTP server to same FTP server, I would use local server toget
andput
the file but this would waste too much time transfering a FullBackup. It mean last backup daily file for each month will move to Monthly directory. - The day 1 of January of each year, last done backup will move to Yearly Directory. The reason is the same of the monthly backup. it mean last backup monthly file for each year will move to Year directory.
- When Backup finish, cPanel will send a email notification with the log of backup and upload FTP. Then you could find the backup in the directories structure.
- A log file is created in Logs folder. Enabled DEBUG in config.php if you want more detail in log file.
Since version 1.1 you can show in the browser the flow of the script. To enable Debug mode set to true
the Define variable DEBUG
in config.php
file and force the execution of index.php manually instead of cron.
- Eduardo Estrella Rosario - [email protected] -