Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#165898 - 15/06/2003 10:06 FTP synchronization
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
I'm setting up a website or three, and I'm getting tired of FTPing files this way and that. I'd like the simplest possible solution for keeping a local directory tree in sync with the directory tree at my FTP site. What's the best (free) tool for this job?

Windows or Linux are both fine for me, I just want the easiest possible way to "set it and forget it" and have my local file changes automatically kept in sync with what's on my FTP. Can't use rsync or install any additional daemons, so it needs to use FTP. I do have the lufs and ftpfs installed in my Linux machine, so I could do funky things using FTP automounts, but I'd prefer something a little less kludgy and more reliable.

The one caveat is that it'd be nice if it supported multiple accounts, since I have multiple FTP logins for different web sites.

So, any suggestions?
_________________________
- Tony C
my empeg stuff

Top
#165899 - 15/06/2003 20:41 Re: FTP synchronization [Re: tonyc]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
I just have a batch file that does it for me. Calls out to the DOS "ftp.exe" program. I manually edit the batch file whenever I need a change in behavior (which hasn't been necessary for months). It's actually rather advanced, so that essentially double clicking on the icon does the synching for me.

I don't keep lots of different folders in synch, though. Although I have considered making the batch file advanced enough to do this, and I know I could do it, I haven't bothered. Instead, what I do is maintain two folders each on my home and work PCs:

\TaxiToWork
\TaxiToHome

I just put the files I need to synch into the appropriate folder and hit the icon. My batch file calls out to WinZip to zip the contents and put them in the "synch" location as "taxitowork.zip" or "taxitohome.zip". Within the batch file I choose the direction as well as the synch location (right now, that's either my web site or my empeg player). It builds the FTP script on the fly and even does a little bit of error checking.
_________________________
Tony Fabris

Top
#165900 - 15/06/2003 21:00 Re: FTP synchronization [Re: tfabris]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Yeah I can do batch/Perl/whatever, but I don't want to even have to double-click on anything. I want something that watches my a given directory for me and when something changes locally, it uploads those changes. This doesn't sound so complicated.

I did find a neat Windows program called VUbrief that does pretty slick FTP synchronization (and other types of synchronization), but you have to have it scheduled to run, and each time it runs, it goes out to the target FTP, regardless of whether anything's changed locally. (It's smart about figuring out when things changed and all, but it always wants to look at the target first.)

Found a Perl script out there that does 50% of what I want, maybe I'll customize that a little. I just find it hard to believe nobody else has run into this kind of problem, though.
_________________________
- Tony C
my empeg stuff

Top
#165901 - 15/06/2003 21:09 Re: FTP synchronization [Re: tonyc]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
I just find it hard to believe nobody else has run into this kind of problem, though.
A while back, I'd asked on this very BBS about web-based subscription services for this kind of thing, and they're out there. They host the online storage space and also have slick little client user interfaces. I considered subscribing to one at one point. But then I just broke down and wrote a batch file.
_________________________
Tony Fabris

Top
#165902 - 15/06/2003 21:12 Re: FTP synchronization [Re: tfabris]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Well this is slightly different (and I would think more commonplace) since I'm updating a website, not just trying to back up a bunch of files in case my HD crashes.
_________________________
- Tony C
my empeg stuff

Top
#165903 - 15/06/2003 21:50 Re: FTP synchronization [Re: tonyc]
genixia
Carpal Tunnel

Registered: 08/02/2002
Posts: 3411
I just find it hard to believe nobody else has run into this kind of problem, though.


Not many webmasters would want to do what you are doing. The vast majority are probably single site people who don't really care about automated syncing. The rest are probably working for companies who wouldn't consider ftp to be a valid mechanism for site updating anyway.

Do you have ssh access? It's going to be convoluted without some kind of shell access. What you really want to do is set a script to ssh to each host, tunnel the rsync ports back to you and then rsync to your machine.
Without some kind of shell access it's going to be difficult to ascertain which files need uploading. You could use wget to mirror each site and then do a recursive diff against your working directory, and then ftp the necessary files. But diff isn't necessarily parse friendly. Furthermore, assuming that you are on a symmetric ISP connection, it would be quicker to brute force upload the entire site every day anyway.

Of course, the most elegant non-shell solution would be a perl/php/cgi page that provides you with md5sums of every file on the site. md5sum your working directory, compare with results from that page and upload the differences. You'll need to ensure that new (and possibly deleted files depending on preference) are handled correctly. A side benefit of this is that you can sanity-check the site after upload as well by repeating the md5sums. This solution probably doesn't scale particulary well though - md5summing can take a while.
_________________________
Mk2a 60GB Blue. Serial 030102962 sig.mp3: File Format not Valid.

Top
#165904 - 16/06/2003 06:26 Re: FTP synchronization [Re: genixia]
Dignan
carpal tunnel

Registered: 08/03/2000
Posts: 12344
Loc: Sterling, VA
I agree. I certainly woudn't want that. I mean, aren't there tools that let you work on the files directly on the server? That's basically doing the same thing, and that practice scares me. What if you make a mistake? I wouldn't want to upload an unfinished page, or not be able to recover the old information. There have been a couple instances lately where I've screwed up and needed to download the version on the server.

For someone who knows what he's doing, this may not be as much of a problem. However, my father's company has their website on their own servers, and until a while ago, their graphic design person was opening the files directly from the server and editing them there. The company website got screwed up a few times until I recommended she make a copy first and work on that.
_________________________
Matt

Top
#165905 - 16/06/2003 07:14 Re: FTP synchronization [Re: Dignan]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
I'm not sure this is as complicated as you guys are saying it is.. First off, for my purposes, I wouldn't need md5sums or anything like that. In fact, I don't know if it matters what's living on the target FTP folder. I just need one-way mirroring, really, and hopefully it would operate instantly (or within a minute or so) of the files being updated.

What I was thinking of would be something that would live on my PC, and keep track of the modification times of the files that constitute a given site. When it detects that one of them has changed (modification time has changed) it sends the file to the target FTP site. That's all. I can probably script something myself, but thought something might exist already. Apparently my needs aren't as common as I thought.

The reason I'm not doing this one-file-at-a-time is that often times I'll change six different pages and have to go into an FTP program and select them individually. Uploading the entire site each time is overkill for this, but going and finding each of the files is a hassle. Ideally I'd run my own sites on my own servers, but I don't have the upsteam bandwidth for it on my cable modem.
_________________________
- Tony C
my empeg stuff

Top