Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to have a copy of a web site on my local drive. Then when I make changes to that copy, have those changes automatically updated on the site's server. Ideally I'd like to tell it to only do this for certain file types. Does anybody know of a way to do this with Linux?

share|improve this question

You can use inotify-tools to do this.

See the section "inotifywait example 1 (thanks to Nick Lothian)" for an example of doing what you describe using rsync.

You may need to modify it to use ftp, or whatever, depending on your set up.

It is a fairly trivial thing to check the file extension or use the file command to determine the file type before deciding to transfer the file.

EDIT: Also look at incron. It is an event based crontab rather than a time based crontab. Running things every minute, just in case something has changed, is not an ideal solution.

share|improve this answer
Thanks Richard, those look very useful. – Cyrcle May 19 '10 at 0:01

In theory, there should be away to monitor certain folders for changes, and if changes are made, have a script to automatically transfer them to your web server (presumably via SCP or S/FTP).

At worse, you (or find someone to do it for you) can write a script that checks modified times for certain folders and file types and have it automatically transfer the files for you. The script can be run in a cronjob about ever minute or so.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .