Hi all!
I'm using the bundled cPanel backup script to backup my sites to a different server via FTP. The script works great, except that I have one site which is used for backup of another server, so obviously I don't want to perform a backup of that backup (due to size and redundancy).
I have edited a different backup script (written in PHP) which I use on my Ensim servers, adding a line as such:
[PHP]if ($domain == "ignore.this.domain") return;[/PHP] this single line does exactly what I want (i.e. skip a single site I don't want to backup).
That's fine and dandy since the script I modified is written in PHP, but I honestly don't have a clue about Perl coding. SO, I'm hoping that anyone who knows Perl can help me with this. The snippet below is from the cPanel backup script and is the subroutine which I think all the backup action takes place.
Can somebody please help me and provide a piece of code that does the same effect as the above PHP code? All I know is that cPanel "sites" are actually "users" in the /home dir, but I don't understand any of the following code....
* the following is in PERL *
[PHP]sub backupaccts {
my($target) = @_;
system("touch","${target}");
#if another cpbackup starts just go bye bye
if (!($CONF{'BACKUPFILES'} eq "no")) {
if (! -e "$target/files") {
mkdir("$target/files",0700);
}
my($file);
foreach $file (@FILES) {
next if (! -e $file);
my $rawfile = $file;
$rawfile =~ s///_/g;
if ($CONF{'BACKUPINC'} eq "yes") {
cpusystem("rsync","-a","--delete","$file","$target/files/$rawfile");
} else {
cpusystem("cp","-f","$file","$target/files/$rawfile");
chmod(0600,"$target/files/$rawfile");
cpusystem("gzip","-f","$target/files/$rawfile");
chmod(0600,"$target/files/$rawfile.gz");
}
}
my($file);
if (! -e "$target/dirs") {
mkdir("$target/dirs",0700);
}
foreach $dir (@DIRS) {
next if (! -e $dir);
my $rawdir = $dir;
$rawdir =~ s///_/g;
if ($CONF{'BACKUPINC'} eq "yes") {
cpusystem("rsync","-a","--delete","$dir/","$target/dirs/$rawdir");
} else {
cpusystem("tar","cfzp","$target/dirs/$rawdir.tar.gz","$dir");
chmod(0600,"$target/dirs/$rawdir.tar.gz");
}
}
}[/PHP]
Please help!! :confused:
p/s - maybe this is not even the correct bit of code to edit ...... I don't know, I told you I can't read Perl!!