Created
January 8, 2009 16:59
-
-
Save nicksieger/44781 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
class Integer | |
def days; hours * 24; end | |
def hours; minutes * 60; end | |
def minutes; seconds * 60; end | |
def seconds; self; end | |
end | |
def snapshot(name) | |
system "zfs destroy -r FileHub@#{name}" | |
system "zfs snapshot -r FileHub@#{name}" | |
end | |
today = Time.new # Time.local(2009,1,1) | |
time = today - 1.days | |
# Take monthly snapshot for prior month on 1st of month | |
snapshot "m%02d" % time.month if today.day == 1 | |
# Take daily snapshot | |
snapshot "d%02d" % time.day |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment