Title photo
frugal technology, simple living and guerrilla large-appliance repair

Regular blog here, 'microblog' there

Many of my traditional blog post live on this site, but a great majority of my social-style posts can be found on my much-busier microbloging site at updates.passthejoe.net. It's busier because my BlogPoster "microblogging" script generates short, Twitter-style posts from the Linux or Windows (or anywhere you can run Ruby with too many Gems) command line, uploads them to the web server and send them out on my Twitter and Mastodon feeds.

I used to post to this blog via scripts and Unix/Linux utilities (curl and Unison) that helped me mirror the files locally and on the server. Since this site recently moved hosts, none of that is set up. I'm just using SFTP and SSH to write posts and manage the site.

Disqus comments are not live just yet because I'm not sure about what I'm going to do for the domain on this site. I'll probably restore the old domain at first just to have some continuity, but for now I like using the "free" domain from this site's new host, NearlyFreeSpeech.net.

Wed, 25 Sep 2013

Synchronizing a filesystem between a local drive and a server via ftp (or, as suggested, rsync or Unison)

Is it possible to synchronize a local filesystem (really a directory and everything below it) with a filesystem/bunch-of-directories-and-files on a server with an ftp client application like FileZilla?

What I'm looking to do is create files and directories on my local drive and then use the client application to automatically (or at least semi-automatically) upload those new items to the server without me having to "drag them over" in the FTP client. I want to keep both directories in sync, much like Dropbox does, but without a third-party service in the middle, and without needing to upload the whole directory and contents, but just the changed/new items.

On the FileZilla forum, it is suggested that the tool for this job is not ftp but rsync.

I use rsync all the time for my local backups, and I'm not terribly well-versed in using it with ssh over the network, but I will look into this and see what I can come up with.

Others are suggesting Unison (1), (2), (3), (4) (5), which builds on rsync.

To make a long story I don't yet understand a whole lot shorter, rsync works in one direction, Unison in both, which can be better for backups when things are potentially changing on both server and client (or server and server, for that matter).

Problem with Unison: You must have Unison on both systems, and my shared hosting account's CentOS box doesn't offer it. It does have rsync, so I might have to go with that. Or I could just continue with my current arrangement of either working with the server's filesystem mounted over sftp most of the time, pushing local files over sftp some of the time, and using sftp to pull down backups on a regular basis.

Possible solution -- Csync: Rob suggests in the comments below that csync could work for this task. It only needs to be on the client side, and it both pushes and pulls files.

I've already installed it, and I'll look into making it work.

What I'm trying to do is keep filesystems in sync across different systems where there are potentially new and changed files on both sides.