WHM Backup Solutions Free, Opensource cPanel Reseller Backup Automation Script

Configuration

Configuring the script is simple, just open config.php and follow our configuration guide to get you on your way in only a matter of minutes. If you want to use multiple configuration files please see our guide below.


Options Value Example Value
$config[‘date_format’] The date format is shown in the logs, this format can be altered to suit localised preferences. For the full list of possible values see https://secure.php.net/manual/en/function.date.php. F j, Y, g:i:s a
$config[‘timezone’] To ensure the log dates and times line up with where you are, you can set the timezone your in. Possible values can be found https://secure.php.net/manual/en/timezones.php. Europe/London
$config[‘obfuscate_config’] To provide an additional layer of security albeit minor, you can obfuscate config.php the next time a backup list is generated. To do this just set the variable to true and your config.php contents will then be obfuscated and moved to secure-config.php and config.php will be deleted.
NOTE: This is not encryption! As the details of the config do need to be accessed by the script, your config will NOT be one way encrypted by setting this variable to true. This merely provides a basic obfuscation technique.
false
$config[‘check_version’] To ensure you are running the latest version of this script every time you generate a new backup you can enable checks back to https://whmbackup.solutions/check_version/.
There are 3 levels of update notifications you can set the configuration variable to.
0 – Disable Checking For Updates.
1 – Notify of Major Update.
2 – Notify of Major & Minor Updates.
2
$config[‘whm_hostname’] This is the hostname or ip address of the cPanel server your reseller is hosted on. mydomain.com
$config[‘whm_port’] The cPanel login port value. Typically this is 2086 for Non-SSL and 2087 for SSL connections. 2087
$config[‘whm_username’] This is your username used to login to your WHM. mydomain
$config[‘whm_auth’] To authenticate into your account this value can be set to either password or hash. The password or hash should then be entered into $config[‘whm_auth_key’];
password – Is the password used to login to your WHM.
hash – This is using the hash generated within WHM (Remote Access Key or API Token)
hash
$config[‘whm_auth_key’] This is the value of the password or hash to login with. myauthtoken
$config[‘type_of_backup’] The values of this setting can be numbers 1 to 6 as listed below.
1 = Backup All Accounts
2 = Backup Accounts Based On Account Username
3 = Backup Accounts Based On Hosting Package
4 = Backup Accounts Based On Primary Account Domain
5 = Backup Accounts Based On Account Owner
6 = Backup Accounts Based On IP
1
$config[‘backup_criteria’] Based on the type_of_backup setting above this should be set to the username/package/domain/owner/ip you want backing up. To seperate multiple criteria use commas.
E.g. user1,user2,user3
E.g. package1,package2,package3
NOTE: This will be ignored if $config[‘type_of_backup’] is set to 1
$config[‘backup_exclusions’] You can exclude accounts from being backed up by entering their usernames in this field.
$config[‘backup_email’] Specifying an email address in this field will cause a cPanel generated email for each account to be sent, the backup log generated by this script will also be sent to the email address specified. If this is left blank, email reports are disabled. [email protected]
$config[‘backup_destination’] Possible values are homedir, ftp, passiveftp or scp.
homedir – Will cause a backup to be placed in the users home directory.
ftp – Will cause a backup to be sent to a remote FTP server.
passiveftp – Will cause a backup to be sent to a remote FTP server.
scp – Will cause a back to be sent to SSH or SFTP storage.
ftp
$config[‘backup_server’] The hostname/ip address of your remote FTP or SCP storage.
NOTE: This field is only required when $config[‘backup_destination’] is set to ftp, passiveftp or scp.
ftp.myftpserver.com
$config[‘backup_port’] The port to access your remote FTP or SCP storage.
e.g. Default FTP port is 21.
e.g. Default SSH port is 22.
NOTE: This field is only required when $config[‘backup_destination’] is set to ftp, passiveftp or scp.
21
$config[‘backup_user’] The username to access the remote FTP or SCP storage.
NOTE: This field is only required when $config[‘backup_destination’] is set to ftp, passiveftp or scp.
ftpusername
$config[‘backup_pass’] The password required to access the remote FTP or SCP storage.
NOTE: This field is only required when $config[‘backup_destination’] is set to ftp, passiveftp or scp.
ftppassword
$config[‘backup_rdir’] This is the file path on the remote server to store the backups.
NOTE: Please note this folder path must exist.
NOTE: This field is only required when $config[‘backup_destination’] is set to ftp, passiveftp or scp.
/
$config[‘max_backups_per_account’] This will set the maximum number of backups to keep for each account found on the FTP server.
NOTE: This only has to be set if you are using the “ftp_retention.php” script.
NOTE: Please note this checks for files with the following name format “backup-MONTH.DAY.YEAR_HOUR-MINUTE-SECOND_USERNAME.tar.gz”. Therefore if backups from other servers are stored in the same folder the script may also remove those backups in line with this retention setting.
3



Multiple Configuration Files

To run multiple configuration files create each config, save them in the root folder of the backup script and name them config-NAME.php. NAME is to be replaced with a single alphanumeric word of your choice, please note NAME can not be set to “generate” or “force” as these variables are reserved for other functionality in the script.
To then run the script using your new config you simply add config= and then the NAME of the config to the cron job as shown below. This applies to both the ftp_retention.php and whmbackup.php.

php -q /home/user/whmbackupsolutions/whmbackup.php config=NAME
php -q /home/user/whmbackupsolutions/whmbackup.php config=NAME generate
php -q /home/user/whmbackupsolutions/ftp_retention.php config=NAME

Still having issues with the script? Check out our Troubleshooting guide.


WHM Backup Solutions Free, Opensource cPanel Reseller Backup Automation Script

Recent Posts

Get in touch

Need a bit of help or have a suggestion? Get in touch with us via Facebook or email [email protected].