lib/qdumpfs.rb in qdumpfs-0.8.0 vs lib/qdumpfs.rb in qdumpfs-0.9.0
- old
+ new
@@ -49,10 +49,11 @@
opts[:delete_dirs] = v.split(/,/)
}
opt.on('--backup-at=YYYYMMDD', 'backup at YYYY/MM/DD') {|v|
opts[:backup_at] = Date.parse(v)
}
+ opt.on('-d', '--debug', 'debug mode') {|v| opts[:d] = v }
opt.parse!(argv)
option = Option.new(opts, argv)
if opts[:v]
puts "<<<<< qdumpfs options >>>>> "
puts "logdir: #{option.logdir}"
@@ -62,12 +63,14 @@
end
begin
command = Command.new(option)
command.run
rescue => e
-# p e.message
-# p e.backtrace
+ if option.debug
+ p e.message
+ p e.backtrace
+ end
puts opt.help
exit
end
end
@@ -168,11 +171,11 @@
t = File.join(today, r) # path of the today's snapshot
begin
# ファイルのアップデート
update_file(s, l, t)
dirs[t] = File.stat(s) if File.ftype(s) == "directory"
- rescue Errno::ENOENT, Errno::EACCES => e
+ rescue => e
wprintf("%s: %s", src, e.message)
next
end
end
return if @opt.dry_run
@@ -203,10 +206,10 @@
else
raise "#{type}: shouldn't be reached here"
end
chown_if_root(type, s, t)
dirs[t] = File.stat(s) if File.ftype(s) == "directory"
- rescue Errno::ENOENT, Errno::EACCES => e
+ rescue => e
wprintf("%s: %s", s, e.message)
next
end
end
restore_dir_attributes(dirs) unless @opt.dry_run