Is making a script for accomplishing a server-to-server backup possible?
I want to regularly copy everything (including databases would be good) in my Frihost web space onto a server I pay for, as a backup. The trick is that I want to make it automated, and I don't want it to have to go through the very slow connection to my PC; I want to go directly from server to server, for a quick high-speed backup.
Is it possible to make (or find) a script to do this? If so, how?
I don't even know the basics of it...
Which server would the script run on?
What language would it use (php hopefully)?
What transfer protocol(s) would it use?
What basic commands would be used by the script for transferring files?
Any help would be great; I've never done a server-to-server connection with php, or anything else that I remember. I don't even know if that is possible. Somehow, the script on one server has to log into the other server, right?
it is possible
I made a script to download files over php a couple of weeks ago, you can use part of that. For the database you should allow access from the backup server to the database (should be some setting in directadmin/cpanel), and just make a php script to backup what you want to backup. Then put the ftp and database stuff in one script (probably easiest with a require()) and run the script with cron.
I was actually waiting for polly-gone to do the design of the ftp script, but I'll just put it online and change it when polly-gone is done.
There is an FTP extension called FXP which enable ftpserver-to-ftpserver direct transfer (both ftp server must support FXP protocol). That would be just what you're looking for right? Also if you own the server or has ssh access to the server, it would be very easy to set up rsync to copy from one server to another.
If you want to code something yourself, remember that your website data can be compromised if you do not add an encryption layer.
You think website data can be compromised when send over unencrypted ftp? Almost everyone uses unencrypted ftp and even worse the direct-admin upload function.
Also the password you enter when logging in on any phpbb forum is not encrypted (normally) and the same for a lot of other login forms.
My script to transfer files over ftp:
The design is just not 100% done. But if you're going to use cron you don't need a design anyway. You should use the class and maybe use parts of the rest to write your own version with the links and stuff hard-coded in it.
It is possible, with script exporting database (there is something like that on the net, even not in phpMyAdmin ) and function "cp()" described in this subject: http://www.frihost.com/forums/vt-96135.html
and "script exporting database" I'd just write a script to get a complete database (or the parts you need). Writing that wouldn't take more than 300 lines I think.