You need to go through the tab "Backup" and manually click to launch such a project but with this script, the backup is done when I want and I am more notified by email. PHP script to allow periodic cPanel backups Automatically, OPTIONALLY to a remote FTP server.This script contains passwords. KEEP ACCESS TO THIS FILE SECURE! (Place it in your home dir, not / www /)
PHP Code:
// Info required for cPanel access
$ Cpus = "Username"; / / Username Used to login to CPanel
$ Cppass = "Password"; / / Password Used to login to CPanel
<span> $ Domain = "<A href ="http:/// / Example.com "> example.com </ a>" / / Domain name WHERE IS CPanel run </ span>
$ Skin = "X"; / / Set to cPanel skin you use (script will not work if it does not match). Most people run the default x theme
/ / Info required for FTP host
$ Ftpuser = "Ftpusername"; / / Username for FTP account
$ Ftppass = "Ftppassword"; / / Password for FTP account
<span> $ Ftphost = "<A href ="http:/// / Ftp.example.com "> ftp.example.com </ a>"; / / Full hostname or IP address for FTP host </ span>
$ Ftpmode = "Ftp"; / / FTP mode ("ftp" for active, "passiveftp" for passive)
/ / Notification information
<span> $ Notifyemail = "You @ <a href ="http:/// / Example.com "> example.com </ a>"; / / Email address to send results </ span>
/ / Secure or non-secure mode
$ Secure = 0; / / Set to 1 for SSL (requires SSL support), Otherwise Will use standard HTTP
/ / Set to a new serie web page APPEAR result in your cron log
$ Debug = 0;
/ / *********** NO CONFIGURATION ITEMS BELOW THIS LINE *********
if ($ Secure) {
$ Url = "ssl: / /".$ Domain;
$ Port = 2083;
} else {
$ Url = $ Domain;
$ Port = 2082;
}
$ Socket = fsockopen($ Url,$ Port);
if (!$ Socket) { echo "Failed to open socket connection ... Bailing out \ n"; exit; }
/ / Encode authentication string
$ Authstr = $ Cpus.":".$ Cppass;
$ Pass = base64_encode($ Authstr);
$ Params = "Dest = $ ftpmode & amp; notifyemail $ email = & amp; ftphost $ server = & amp; user = $ ftpuser & amp; ftppass $ pass = & amp; submit = Generate Backup ";
/ / Make POST to cPanel
fputs($ Socket,"POST / frontend /".$ Skin."/ Backup / dofullbackup.html?".$ Params."HTTP/1.0 \ r \ n");
fputs($ Socket,"Host: $ domain \ r \ n");
fputs($ Socket,"Authorization: Basic $ pass \ r \ n");
fputs($ Socket,"Connection: Close \ r \ n");
fputs($ Socket,"\ R \ n");
/ / Grab response Even If We Do not Do Anything With It.
while (!feof($ Socket)) {
$ Response = fgets($ Socket,4096);
if ($ Debug) echo $ Response;
}
fclose ($ Socket);
?>
Bookmarks