Hi guys,
I recently tried to make backup files of all user accounts.
I tried using /scripts/cpbackup but it wouldn't let me run because it claimed that my backup files were up to date. I know that they were not.
Cpanel should have a 'BACKUP ALL ACCOUNTS NOW' function.
Frustrated, I decided to create a script that scans the homedirectory for user accounts and force Cpanel to create a cpmove backup files in the home directory for each accounts.
Hope this can come in handy for some of you guys.
Just upload the php file to /usr/local/cpanel/whostmgr/docroot/ , login to http://IP:2086/backup.php and get the party started!
![]()
Contents of backup.php
PHP Code:<?
/****************************
Roy
CPanelskindepot.com
****************************/
//********************************
//Set time limit so that we don't exceed PHP's maximum execution time.
//********************************
set_time_limit (99999999999);
/***************************/
//********************************
//Begin Counter. This way we know how many accounts are going to be backed up
//********************************
$i =1;
/***************************/
//********************************
//$noto is just an array of the common non-user directory names.
//********************************
$noto = array('.','..','virtfs','cpins','cpzendinstall','cpapachebuild','.cpan','cpphpbuild');
/***************************/
//********************************
//Let's get the party started
//********************************
if ($handle = opendir('/home')) {
while (false !== ($file = readdir($handle))) {
if((is_dir('/home/'.$file)!==FALSE)&&(!in_array($file,$noto)))
{
echo '<b>'.$i.'</b>Backing up: '.$file.'<br><br>';
echo system('/scripts/pkgacct '.$file);
echo '<br>';
$i++;
}
}
closedir($handle);
}
//********************************
//The end of party
//********************************
?>


LinkBack URL
About LinkBacks
Reply With Quote
I need to get this figured out for security sake~