Class/Module Index [+]

Quicksearch

Backup::Utilities

Constants

NAMES
UTILITY

Public Class Methods

configure(&block) click to toggle source

Configure the path to system utilities used by Backup.

Backup will attempt to locate any required system utilities using a which command call. If a utility can not be found, or you need to specify an alternate path for a utility, you may do so in your config.rb file using this method.

Backup supports both GNU and BSD utilities. While Backup uses these utilities in a manner compatible with either version, the tar utility requires some special handling with respect to +Archive+s. Backup will attempt to detect if the tar command found (or set here) is GNU or BSD. If for some reason this fails, this may be set using the tar_dist command shown below.

Backup::Utilities.configure do
  # General Utilites
  tar      '/path/to/tar'
  tar_dist :gnu   # or :bsd
  cat      '/path/to/cat'
  split    '/path/to/split'
  sudo     '/path/to/sudo'
  chown    '/path/to/chown'
  hostname '/path/to/hostname'

  # Compressors
  gzip    '/path/to/gzip'
  bzip2   '/path/to/bzip2'
  lzma    '/path/to/lzma'   # deprecated. use a Custom Compressor
  pbzip2  '/path/to/pbzip2' # deprecated. use a Custom Compressor

  # Database Utilities
  mongo       '/path/to/mongo'
  mongodump   '/path/to/mongodump'
  mysqldump   '/path/to/mysqldump'
  pg_dump     '/path/to/pg_dump'
  pg_dumpall  '/path/to/pg_dumpall'
  redis_cli   '/path/to/redis-cli'
  riak_admin  '/path/to/riak-admin'

  # Encryptors
  gpg     '/path/to/gpg'
  openssl '/path/to/openssl'

  # Syncer and Storage
  rsync   '/path/to/rsync'
  ssh     '/path/to/ssh'

  # Notifiers
  sendmail  '/path/to/sendmail'
  exim      '/path/to/exim'
  send_nsca '/path/to/send_nsca'
end

These paths may be set using absolute paths, or relative to the working directory when Backup is run.

Note that many of Backup’s components currently have their own configuration settings for utility paths. For instance, when configuring a MySQL database backup, mysqldump_utility may be used:

database MySQL do |db|
  db.mysqldump_utility = '/path/to/mysqldump'
end

Use of these configuration settings will override the path set here. (The use of these may be deprecated in the future)

# File lib/backup/utilities.rb, line 114
def configure(&block)
  DSL.instance_eval(&block)
end
gnu_tar?() click to toggle source
# File lib/backup/utilities.rb, line 123
def gnu_tar?
  return @gnu_tar unless @gnu_tar.nil?
  @gnu_tar = !!run("#{ utility(:tar) } --version").match(/GNU/)
end
tar_dist(val) click to toggle source
# File lib/backup/utilities.rb, line 118
def tar_dist(val)
  # the acceptance tests need to be able to reset this to nil
  @gnu_tar = val.nil? ? nil : val == :gnu
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.