Synchronization by `` lftp
4 commenti » Backup , Open Source , Shell , System , Tips & Tricks 4 Comments »
This week has been very, very hard ... but I can not let it end without having gone online at least a small, miserable, insignificant tip!
So to do things on the fly, I tell you how I make the synchronization of a website that I have developed locally with the copy that is published in a directory of your FTP space.
I state that this is not the way I work as normal: a good child of the 70s I edit the code directly online, not in production, but online (bash). This week I happened, however, having to hack the website of a client who has placed at my disposal only and exclusively on its FTP account. So I started developing a local copy of your website and keep synchronized with the online version of a single, simple, wonderful command:
lftp -u 'username,password' ftp.mydomain.com -e "set ftp:ssl-protect-data true;mirror --reverse /home/ivan/test test; exit;"
In other words:
- username: the username for the FTP
- Password: The password associated with the username of ftp
- ftp.mydomain.com: the host FTP account
- / Home / ivan / test: the local folder (without trailing slash)
- tests: the remote folder (ie one where there is posted on website)
Note the option "set ftp:ssl-protect-data true" that protects the authentication and SSL FTP through the "mirror-reverse" that allows you to synchronize downloads rather than uploads.
Needless to say, with the same command you can keep a remote backup to a local directory, although this type of thing we recommend the use of `rsync` that does everything through `ssh`.
Nothing more, nothing less. Happy weekend!







