diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-06-03 14:57:26 +0100 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-06-03 14:57:26 +0100 |
commit | 5dee2ed427e931b3fa72282482dd27d087288bd2 (patch) | |
tree | 08a0e259f5b0d5559a2523253623e1c1dc20ed43 /byteback-snapshot | |
parent | fb24c99820c74964d71790387d0f7fe93dca073a (diff) |
Reformatted.
This involved fixing the literal TAB characters, changing the quotes,
and similar non-functional edits.
Diffstat (limited to 'byteback-snapshot')
-rwxr-xr-x | byteback-snapshot | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/byteback-snapshot b/byteback-snapshot index 6249d3d..fc9aab3 100755 --- a/byteback-snapshot +++ b/byteback-snapshot @@ -4,39 +4,37 @@ # using btrfs subvolume commands. # -$LOAD_PATH.unshift("/usr/lib/byteback") +$LOAD_PATH.unshift('/usr/lib/byteback') require 'trollop' require 'byteback' include Byteback include Byteback::Log -opts = Trollop::options do +opts = Trollop.options do + opt :root, 'Backups directory (must be a btrfs subvolume)', + type: :string - opt :root, "Backups directory (must be a btrfs subvolume)", - :type => :string - - opt :snapshot, "(ignored for compatibility)" - - opt :verbose, "Print diagnostics" + opt :snapshot, '(ignored for compatibility)' + opt :verbose, 'Print diagnostics' end @root = opts[:root] @verbose = opts[:verbose] -fatal("--root not readable") unless File.directory?("#{@root}") +fatal('--root not readable') unless File.directory?("#{@root}") @backups = BackupDirectory.new(@root) snapshots = @backups.snapshots -if !snapshots.empty? - last_snapshot_time = snapshots.last.time - fatal("Last snapshot was less than six hours ago") unless - !last_snapshot_time || - Time.now - last_snapshot_time >= 6*60*60 # FIXME: make configurable +unless snapshots.empty? + last_snapshot_time = snapshots.last.time + fatal('Last snapshot was less than six hours ago') unless + !last_snapshot_time || + Time.now - last_snapshot_time >= 6 * 60 * 60 # FIXME: make configurable end -info "Making new snapshot" +info 'Making new snapshot' @backups.new_snapshot! -info "Finished" +info 'Finished' |