Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › PHP/MYSQL CPanel Auto Full Backup
New Posts  All Forums:Forum Nav:

PHP/MYSQL CPanel Auto Full Backup

post #1 of 4
Thread Starter 
I've tried running the following file with cron
Code:
<?php

// 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/)

// ********* THE FOLLOWING ITEMS NEED TO BE CONFIGURED *********

// Info required for cPanel access
 = "cpanel user"; // Username used to login to CPanel
 = "cpanel pass"; // Password used to login to CPanel
 = "cpanel domain"; // Domain name where CPanel is run
 = "x3"; // Set to cPanel skin you use (script won't work if it doesn't match). Most people run the default x theme

// Info required for FTP host
 = "ftp user"; // Username for FTP account
 = "ftp pass"; // Password for FTP account
 = "ftp host"; // Full hostname or IP address for FTP host
 = "ftp"; // FTP mode ("ftp" for active, "passiveftp" for passive)

// Notification information
 = "admin-email"; // Email address to send results

// Secure or non-secure mode
 = 0; // Set to 1 for SSL (requires SSL support), otherwise will use standard HTTP

// Set to 1 to have web page result appear in your cron log
 = 0;

// *********** NO CONFIGURATION ITEMS BELOW THIS LINE *********

if () {
    = "ssl://".;
    = 2083;
} else {
    = ;
    = 2082;
}

 = fsockopen(,);
if (!) { echo "Failed to open socket connection… Bailing out!n"; exit; }

// Encode authentication string
 = .":".;
 = base64_encode();

 = "dest=&email=&server=&user=&pass=&submit=Generate Backup";

// Make POST to cPanel
fputs(,"POST /frontend/".."/backup/dofullbackup.html?".." HTTP/1.0rn");
fputs(,"Host: rn");
fputs(,"Authorization: Basic rn");
fputs(,"Connection: Closern");
fputs(,"rn");

// Grab response even if we don't do anything with it.
while (!feof()) {
   = fgets(,4096);
  if () echo ;
}

fclose();
?>
But I can't find the backup file in my home directory where the the email that tells you the outcome of the backup said the file is. It said it was a success :/
Using CPanel 11 Theme X3

BTW, variables have been stripped here .
post #2 of 4
an easier way. is with root to login to WHM and go to Main >> Backup >> Configure Backup

    
CPUMotherboardGraphicsRAM
2500k Biostar TP67XE MSI 5870 ddr3-1600 gskill 4x2GB 
Hard DriveOSMonitorKeyboard
Intel X25-m G2 80GB (trim fw) W7 64bit viewsonic 21.5 1080p Deck legend (red) 
PowerCaseMouseMouse Pad
750 watt silencer FT02b-w G500 steelpad 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
2500k Biostar TP67XE MSI 5870 ddr3-1600 gskill 4x2GB 
Hard DriveOSMonitorKeyboard
Intel X25-m G2 80GB (trim fw) W7 64bit viewsonic 21.5 1080p Deck legend (red) 
PowerCaseMouseMouse Pad
750 watt silencer FT02b-w G500 steelpad 
  hide details  
Reply
post #3 of 4
Thread Starter 
Don't see it in my WHM
Yes, I have WHM! (# Support
#

Cluster/Remote Access
#

Server Status
#

Account Information
#

Account Functions
#

Multi-Account Functions
#

FrontPage
#

Themes
#

Packages
#

DNS Functions
#

cPanel
#

Plugins )
post #4 of 4
Quote:
Originally Posted by LyokoHaCk View Post
Don't see it in my WHM
Yes, I have WHM! (# Support
#

Cluster/Remote Access
#

Server Status
#

Account Information
#

Account Functions
#

Multi-Account Functions
#

FrontPage
#

Themes
#

Packages
#

DNS Functions
#

cPanel
#

Plugins )
you do not have root mate.

Quote:
server configuration
support
networking setup
security
server contacts
resellers
service configuration
languages
backup
cluster/remote access
system reboot
server status
account information
account functions
multi-account functions
front page
transfers
themes
packages
DNS functions
sql services
ip functions
disk drives
software
email
system health
cpanel
ssl/tls
restart services.
contact your host and ask them if daily/weekly and monthly backups are automatically made of your /home/account directory. including mysql users/tables if they do not. request that they do. if they do not. move..
    
CPUMotherboardGraphicsRAM
2500k Biostar TP67XE MSI 5870 ddr3-1600 gskill 4x2GB 
Hard DriveOSMonitorKeyboard
Intel X25-m G2 80GB (trim fw) W7 64bit viewsonic 21.5 1080p Deck legend (red) 
PowerCaseMouseMouse Pad
750 watt silencer FT02b-w G500 steelpad 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
2500k Biostar TP67XE MSI 5870 ddr3-1600 gskill 4x2GB 
Hard DriveOSMonitorKeyboard
Intel X25-m G2 80GB (trim fw) W7 64bit viewsonic 21.5 1080p Deck legend (red) 
PowerCaseMouseMouse Pad
750 watt silencer FT02b-w G500 steelpad 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › PHP/MYSQL CPanel Auto Full Backup