Permalink
Browse files

add config flags for keeping remote files and progressive transfer. r…

…esolves #3
  • Loading branch information...
1 parent 0d5f3fa commit 2327a26bf771f47e786aff6fa406d93da4910df1 @josephholsten josephholsten committed Jan 2, 2011
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/rsync_command.rb
View
@@ -117,8 +117,12 @@ def backup
delete_pid_file(command_name)
exit(0)
end
-
- rsync_command = "#{rsync_binary} -e 'ssh -oServerAliveInterval=3 -oServerAliveCountMax=1' --delete -avz #{@local_source_path}/ #{strongspace.username}@#{strongspace.username}.strongspace.com:#{@strongspace_path}/"
+
+ rsync_flags = "-e 'ssh -oServerAliveInterval=3 -oServerAliveCountMax=1' "
+ rsync_flags << "-avz "
+ rsync_flags << "--delete " unless @keep_remote_files
+ rsync_flags << "--partial --progress" if @progressive_transfer
+ rsync_command = "#{rsync_binary} #{rsync_flags} #{@local_source_path}/ #{strongspace.username}@#{strongspace.username}.strongspace.com:#{@strongspace_path}/"
puts "Excludes: #{@excludes}" if DEBUG
for pattern in @excludes do
rsync_command << " --exclude \"#{pattern}\""
@@ -351,6 +355,8 @@ def load_configuration
@local_source_path = @config['local_source_path']
@strongspace_path = @config['strongspace_path']
+ @keep_remote_files = @config['keep_remote_files']
+ @progressive_transfer = @config['progressive_transfer']
@excludes = []
@excludes = @config['excludes'] if @config.has_key? 'excludes'

0 comments on commit 2327a26

Please sign in to comment.