Module: BackupPlugins::Files

Included in:
Keepitsafe
Defined in:
lib/plugins/files.rb

Instance Method Summary collapse

Instance Method Details

#files(path) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/plugins/files.rb', line 3

def files path

  puts "\n\tbackup.files(#{path})\n"
  
  path = run_cmd("echo #{path}").strip # expand "~/"
  
  file_target_dir = "#{backup_target_dir}#{path}"
  
  run_cmd("mkdir -p #{file_target_dir}")

  cmd = "cp -a #{path} #{file_target_dir}"

  unless(run_cmd('which ionice').blank? || run_cmd('ionice -c3 ls').match(/ioprio_set: Operation not permitted/))
    cmd = "ionice -c3 #{cmd}"
  end
    
  puts run_cmd(cmd)

end