Created
January 28, 2010 18:52
-
-
Save winton/289018 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def rsync | |
| puts `rbackup #{ARGV.first}` | |
| end | |
| rsynced_at = nil | |
| rsync | |
| while true | |
| modified = `find #{File.dirname(__FILE__)}/breport #{File.dirname(__FILE__)}/../active/a_b -mmin -1`.split("\n") | |
| modified.delete_if { |m| m.include?('.git') } | |
| modified.each do |path| | |
| path = File.expand_path(path) | |
| begin | |
| mtime = File.mtime(path) | |
| if !rsynced_at || mtime > rsynced_at | |
| rsynced_at = Time.now | |
| rsync | |
| end | |
| rescue Exception => e | |
| rsynced_at = Time.now | |
| rsync | |
| end | |
| end | |
| sleep 2 | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment