Results 1 to 1 of 1
-
03-15-2013, 07:05 AM #1Newbie
- Join Date
- Mar 2004
- Location
- IWantMyAccountDeleted
- Posts
- 14
cPanel FTP backup small fix to latest cPanel version
Hi, I haven't kept track of who are using my little modification for remote FTP backup with friendly folder names. I assume you already know that cPanel moved away from standard perl citaat "cPanel will no longer update Perl modules or install new Perl modules to usr/lib or /usr/local/lib If you have scripts that need to work with cPanel code, we recommend you make the following changes to the top of your Perl scripts. This modification will allow the scripts to work with all cPanel installs"
Anyway, I solved it as follow; insert/replace around row 40 the following.
# Nick - begin rotation configuration
# Convert a time as returned by the time function to a 9-element list with the time analyzed for the local time zone.
# Typically used as follows 0 1 2 3 4 5 6 7 8
#($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
# declare the variables and call the function.
#
my $sec; my $min; my $hour; my $mday; my $mon; my $year; my $wday; my $yday; my$isdst;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
my @abbrmonth = qw( January February March April May June July August September October November December );
my @abbrweekday = qw( Sunday Monday Tuesday Wednesday Thursday Friday Saturday );
#
# declare our new folder names.
#
my $dayOfWeek;
my $nameOfMonth;
my $dayOfWeek = $abbrweekday[$wday];
my $nameOfMonth = $abbrmonth[$mon];
#
print "Today is: " . $dayOfWeek . " in the month: " . $nameOfMonth;
print "\n";
# Nick - end rotation configuration
Now rows are moved a little in my cpbackup file it is now row 922
This is the FTP upload section.
Replace/insert with
# Nick - begin rotation configuration
if ($backtype eq 'daily')
{
$ftp->mkdir("${ftproot}/${backtype}/$dayOfWeek");
$ftp->cwd("${ftproot}/${backtype}/$dayOfWeek");
}
elsif ($backtype eq 'weekly')
{
$ftp->mkdir("${ftproot}/${backtype}/$dayOfWeek");
$ftp->cwd("${ftproot}/${backtype}/$dayOfWeek");
}
elsif ($backtype eq 'monthly')
{
$ftp->mkdir("${ftproot}/${backtype}/$nameOfMonth");
$ftp->cwd("${ftproot}/${backtype}/$nameOfMonth");
}
# Nick - end of rotation configuration
When modified upload and protect the file for overwriting.
chattr +i /usr/local/cpanel/scripts/cpbackup
Nick
Similar Threads
-
[Solution] Fix vulnerable wordpress site & upgrade it to the latest version
By Mxhub in forum Hosting Security and TechnologyReplies: 4Last Post: 09-07-2009, 11:43 PM -
Upgrade to Latest Version Cpanel ! ERROR
By binh_mos in forum Hosting Security and TechnologyReplies: 1Last Post: 07-24-2006, 05:14 AM -
Cpanel: Finding latest stable version
By shasta in forum Hosting Software and Control PanelsReplies: 2Last Post: 07-01-2006, 06:30 PM -
is this latest version of cPanel?
By Kongyang in forum Hosting Software and Control PanelsReplies: 3Last Post: 12-06-2005, 06:06 PM -
Latest version of CPanel?
By cortices in forum Hosting Software and Control PanelsReplies: 1Last Post: 03-12-2003, 10:18 PM