class Snapback::Filesystem

Constants

LOCKED_FILES

Public Class Methods

mount(device, directory) click to toggle source
# File lib/snapback/filesystem.rb, line 6
def self.mount(device, directory)
  # If it's already mounted, don't worry
  mount_status = Open4::popen4("mountpoint -q #{directory}") do |pid, stdin, stdout, stderr|
  end

  if mount_status == 0 then
    return true
  end

  `mount #{device} #{directory}`
end
move_mysql_files(from_directory, to_directory) click to toggle source
# File lib/snapback/filesystem.rb, line 30
def self.move_mysql_files(from_directory, to_directory)
  Dir.foreach(from_directory) do |filename|
    if !LOCKED_FILES.include?(filename) then
      run_command "Moving #{from_directory}/#{filename} to #{to_directory}",
        "mv #{from_directory}/#{filename} #{to_directory}"
    end
  end
end
unmount(directory) click to toggle source
# File lib/snapback/filesystem.rb, line 18
def self.unmount(directory)
  # If it's already unmounted, don't worry
  mount_status = Open4::popen4("mountpoint -q #{directory}") do |pid, stdin, stdout, stderr|
  end

  if mount_status != 0 then
    return true
  end

  `umount #{directory}`
end