Files & Directories compression

Archive files or directories using various compression algorithms

tar_gz

Collect files to a tar archive and compress the archive using gzip.

Typical usage

Compress a file

host "app-host", hostname: "www.example.com"

job "config-backup" do
  resource "file", path: "/etc/config/file", host: "app-host"
  remotely as: "user" do
    tar_gz
  end
end

Compress a directory

host "app-host", hostname: "www.example.com"

job "config-backup" do
  resource "directory", path: "/var/www/uploads", host: "app-host"
  remotely as: "user" do
    tar_gz
  end
end

Exclude some files or directories

host "app-host", hostname: "www.example.com"

job "config-backup" do
  resource "directory", path: "/var/www/uploads", host: "app-host"
  remotely as: "user" do
    tar_gz exclude: ["subdirectory/*.*", "*.jpg"]
    # or, for a single pattern:
    # tar_gz exclude: "subdirectory/*.*"
  end
end

Input resources

Resources of type file or directory are allowed.

Output resource

A resource of type file.

Command options

OptionDescription
delete_sourceIndicate whether the source file or directory should be deleted after compression. Use with caution.Required: no
Defaults to: false
excludeInclude some files based on an array of patterns.Required: no