hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Web Hosting Talk Tutorials : Programming Tutorials : cPanel FTP backup small fix to latest cPanel version
Reply

Forum Jump

cPanel FTP backup small fix to latest cPanel version

Reply Post New Thread In Programming Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 03-15-2013, 07:05 AM
Nick57 Nick57 is offline
Newbie
 
Join Date: Mar 2004
Location: Bristol, UK
Posts: 11
Post

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



Sponsored Links
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Solution] Fix vulnerable wordpress site & upgrade it to the latest version Mxhub Hosting Security and Technology 4 09-07-2009 11:43 PM
Upgrade to Latest Version Cpanel ! ERROR binh_mos Hosting Security and Technology 1 07-24-2006 05:14 AM
Cpanel: Finding latest stable version shasta Hosting Software and Control Panels 2 07-01-2006 06:30 PM
is this latest version of cPanel? Kongyang Hosting Software and Control Panels 3 12-06-2005 06:06 PM
Latest version of CPanel? cortices Hosting Software and Control Panels 1 03-12-2003 10:18 PM

Related posts from TheWhir.com
Title Type Date Posted
cPanel & WHM Software 11.36 Reaches Stable Tier Status Web Hosting News 2013-04-09 11:44:33
Hosting Control Panel cPanel & WHM 11.34 Release Hits Stable Tier Web Hosting News 2012-11-12 17:04:57
cPanel Releases cPanel, WHM 11.34 with New User Interface Web Hosting News 2012-10-16 13:09:49
cPanel Conference 2012: What's New with cPanel and WHM with Ken Power Web Hosting News 2012-11-12 13:54:56
CloudBerry Launches Version 2.9 of Cloud Backup for Amazon S3, Azure Web Hosting News 2012-06-25 16:38:04


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?