Last active
August 29, 2015 14:10
-
-
Save iamajeesh/fe396e0a84601c09ca3d to your computer and use it in GitHub Desktop.
php Cpanel Backup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/**************************** | |
Original Auther: | |
Roy | |
CPanelskindepot.com | |
Modded By: | |
Ajeesh | |
Ajee.sh | |
****************************/ | |
//******************************** | |
//Set time limit so that we don't exceed PHP's maximum execution time. | |
//******************************** | |
set_time_limit (9999999999999999999); | |
/***************************/ | |
//******************************** | |
//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','cPanelInstall', 'cpbackuptmp', ' cpeasyapache','.cpan','.cpanm','.cpcpan','cPanelInstall','cpbackuptmp','cpeasyapache','virtfs'); | |
/***************************/ | |
//******************************** | |
//Let's get the party started | |
//******************************** | |
system('cd /home; find . -name "error_log" -exec rm -rf {} \;'); | |
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); | |
$date= date("Y-m-d"); | |
system('cd ~/aj ; mkdir '.$date.'; mv /home/*.tar.gz ~/aj/'.$date.'/'); | |
//system('cd /home; find . -name "error_log" -exec rm -rf {} \;'); | |
} | |
//******************************** | |
//The end of party | |
//******************************** | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment