There are many softwares and solutions that permit to keep in sync two or more hosts (like Rsync, Unison, etc), but when the sync must be made through Internet and you have access only to the ftp or http service your choices narrow down. This is the typical situation you can face on a shared hosting solution.
A great solution to synchronize two directories on different hosts through ftp or http protocol is LFTP :
LFTP is sophisticated ftp/http client, file transfer program supporting a number of network protocols. Like BASH, it has job control and uses readline library for input. It has bookmarks, built-in mirror, can transfer several files in parallel. It was designed with reliability in mind
LFTP has many useful features, like :
- FISH and SFTP protocols support
- Built-in mirror and reverse mirror (mirror -R)
- Job queueing
- Job execution at specified time
- Comprehensive scripting support
- FXP transfers support (between two FTP servers, bypassing client machine)
See the complete list of features
To keep in sync two directories on two hosts on Internet you need to create a little shell script and set a cron job for it on one host and create an ftp access on the other host.
For example for BASH shell :
#!/bin/bash #Synchronization script lftp -u [remote username],[remote password] [remote host] <<EOF set ftp:ssl-allow no mirror [remote directory to sync] [local directory to sync] quit 0 EOF
Parameters :
- [remote username] : remote ftp username
- [remote password] : remote ftp password
- [remote host] : remote hostname or ip address
- [local directory to sync] : local directory to synchronize
- [remote directory to sync] : remote directory to synchronize
Other resources : LFTP manual, LFTP tutorial
{ 5 comments }
