diff options
author | Matthew Bloch <matthew@bytemark.co.uk> | 2014-11-05 14:00:45 +0000 |
---|---|---|
committer | Matthew Bloch <matthew@bytemark.co.uk> | 2014-11-05 14:00:45 +0000 |
commit | c88333e19b459685f57ba3f246c3fdd684681542 (patch) | |
tree | 3be762cf0a9ebb57c8a8528bcf98433434d371ad /lib/byteback/disk_free.rb | |
parent | f6c155ff0b261f23b6fc9465b7f2e6d85bab573a (diff) |
Split out -prune from -snapshot, tested the latter on various live setups.
Diffstat (limited to 'lib/byteback/disk_free.rb')
-rw-r--r-- | lib/byteback/disk_free.rb | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/lib/byteback/disk_free.rb b/lib/byteback/disk_free.rb deleted file mode 100644 index 33952a3..0000000 --- a/lib/byteback/disk_free.rb +++ /dev/null @@ -1,41 +0,0 @@ - -module Byteback - # Icky way to find out free disc space on our mount - # - class DiskFree - def initialize(mount) - @mount = mount - end - - def total - all[2] - end - - def used - all[3] - end - - def available - all[4] - end - - def fraction_used - disk_device, disk_fs, disk_total, disk_used, disk_available, *rest = all - disk_used.to_f / disk_available - end - - protected - - def all - disk_device, disk_fs, disk_total, disk_used, disk_available, *rest = - df. - split("\n")[1]. - split(/\s+/). - map { |i| /^[0-9]+$/.match(i) ? i.to_i : i } - end - - def df - `/bin/df -T -P -B1 #{@mount}` - end - end -end |