Thanks to visit codestin.com
Credit goes to gist.github.com

Skip to content

Instantly share code, notes, and snippets.

@winton
Created January 28, 2010 18:52
Show Gist options
  • Select an option

  • Save winton/289018 to your computer and use it in GitHub Desktop.

Select an option

Save winton/289018 to your computer and use it in GitHub Desktop.
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