Backing up accounts (hacky way)
Hi All,
I was wondering if anybody else had experience with using APIv1 (I know, I know) to back up accounts via FTP?
I'm trying to perform a HTTP request to the server to do so with the cPanel account credentials. Here is what I have:
This generates the backup to the homedir successfully, however doesn't even attempt to communicate with the FTP server. Firewalls are disabled on both servers for sanity sake, and entering the above details in to the generate full backup system to transfer over FTP works absolutely fine, it's just this API call that doesn't work. This is on 11.40.13. I am out of ideas personally.
https://server.hostname.net:2083/json-api/cpanel
?cpanel_jsonapi_module=Fileman
&cpanel_jsonapi_func=fullbackup
&cpanel_jsonapi_apiversion=1
&dest=ftp
&server=11.22.11.22
&user=USERNAME
&pass=PASSWORD
&email=email@address.com
&port=21
&rdir=/
This generates the backup to the homedir successfully, however doesn't even attempt to communicate with the FTP server. Firewalls are disabled on both servers for sanity sake, and entering the above details in to the generate full backup system to transfer over FTP works absolutely fine, it's just this API call that doesn't work. This is on 11.40.13. I am out of ideas personally.
-
Thanks. I'm using something similar which is the Perl cPanel::PublicAPI module with no luck. It sends the request, but then just refuses to FTP from there and doesn't even send a completion email :( As there are no logs for the end-user backup process, this can't be easily debugged. Quite frustrating. 0 -
The following thread is dated, but it might help provide you with a general idea of how it's been achieved in the past: Automatic Remote FTP Backup Script Thank you. 0 -
Thanks for the suggestions. I opted to use the cPanel::PublicAPI Perl module for this. I have attached the full working script below in a gist, for reference. /https://gist.github.com/Deehem/6dd15d79775730e64b34 0 -
I tried your script method using the cPanel::PublicAPI Perl module but got a 403 Forbidden Access response. Any idea what it was that was denied and how to fix it? debug: Using user param from object creation debug: Using pass param from object creation debug: loaded serializer: JSON::Syck debug: api_request: ( cPanel::PublicAPI=HASH(0x15f8f80), cpanel, /xml-api/cpanel, POST, HASH(0x15f8ef0), ) debug: failed to load encoder: cPanel/CPAN/URI/Escape.pm debug: loaded encoder: URI/Escape.pm debug: Found port for service cpanel to be 2082 (usessl=0) debug: POST /xml-api/cpanel HTTP/1.1 Host: http://www.domain.net Connection: Close Content-Length: 238 User-Agent: cPanel::PublicAPI (perl) 1.002 Authorization: Basic anJuaG9zdGk6bGVlbmllLTE= arg-4=user@ domain.net&cpanel_xmlapi_module=Fileman&cpanel_xmlapi_cpanel_xmlapi_user=&arg-0=ftp&arg-3= xxxxxxxx&cpanel_xmlapi_apiversion=1&arg-1=nj01.domain.com&arg-6=%252F&arg-2=supersof&arg-5=21&cpanel_xmla pi_func=fullbackup debug: HTTP LINE[HTTP/1.1 403 Forbidden Access denied ] debug: HEADER[content-type]=[text/xml] debug: HEADER[connection]=[close] debug: HEADER[server]=[cpsrvd/11.42.1.13] debug: READ TYPE=close Server Error from domain.net: HTTP/1.1 403 Forbidden Access denied
0 -
[quote="Deehem, post: 1637131">I opted to use the cPanel::PublicAPI Perl module for this.
Hello Daahem, I ran into a problem too, maybe I have missed something... [QUOTE]Can't locate cPanel/PublicAPI.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /home/ACCOUNTNAME/public_html/backup/backup.pl line 3. BEGIN failed--compilation aborted at /home/ACCOUNTNAME/public_html/backup/backup.pl line 3.
Where can i find that Public Api? Had searched in cPanel for it, but nothing was to be found. Kind Regards0 -
I have no idea how to run Perl. I have a Perl Module Installer in cPanel. How do I do this? Do I place the cpanel_backup.pl in th ePerl folder of the directory in FTP? Do I run a cron job? How do I install the Public API? [COLOR="silver">- - - Updated - - - I should mention that I'm on a shared account, not a VPS so it looks like I have to run commands and I don't think I can do that. 0 -
[quote="John connor, post: 1826931">I have no idea how to run Perl. I have a Perl Module Installer in cPanel. How do I do this? Do I place the cpanel_backup.pl in th ePerl folder of the directory in FTP? Do I run a cron job? How do I install the Public API? - - - Updated - - - I should mention that I'm on a shared account, not a VPS so it looks like I have to run commands and I don't think I can do that.
You can upload the custom Perl script to your account's home directory and utilize the path to it when setting up a cron job. The "Perl Modules" option in cPanel should allow you to install the "cPanel: PublicAPI" Perl module. Note that this is an unsupported user-submitted backup script, so it's not something we can support. Thank you.0 -
You can upload the custom Perl script to your account's home directory and utilize the path to it when setting up a cron job. The "Perl Modules" option in cPanel should allow you to install the "cPanel::publicAPI" Perl module. Note that this is an unsupported user-submitted backup script, so it's not something we can support. Thank you.
Michael, what is the best choices for you if you need something like what OP asked ?0 -
Michael, what is the best choices for you if you need something like what OP asked ?
The main purpose of the custom script is to allow cPanel users the ability to automatically backup accounts on a daily basis. If you are asking for the best supported option, it would be to obtain a VPS or dedicated server so you can configure backups as "root" using the supported options provided by cPanel. Thank you.0
Please sign in to leave a comment.
Comments
11 comments