Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers 2

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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.