YandexDisk::CLI
Command line front end for the sync engine.
Exit codes are meant to be read by cron and monitoring: 0 clean, 1
the run finished but something failed, 2 it never got started.
Constants
EXIT_FAILURE = 1
EXIT_OK = 0
EXIT_USAGE = 2
FORMATTER = ::Log::Formatter.new do |entry, io|
(io << (entry.timestamp.to_s("%H:%M:%S"))) << ' '
(io << (entry.severity.label.ljust(5))) << ' '
io << entry.message
end
SAMPLE_CONFIG = "# Where to read the OAuth token from. The token itself can also be set\n# inline with `token:`, but a file or the environment keeps it out of\n# version control.\ntoken_file: /etc/yandex-disk/token\ntoken_env: YANDEX_DISK_TOKEN\n\n# Everything below is placed under this directory on the Disk.\nremote_root: disk:/backups\n\n# Files uploaded at the same time.\nconcurrency: 4\n\n# Files larger than this are uploaded in resumable chunks of this size.\nchunk_size: 16MB\n\n# Do not re-upload a file whose remote copy has the same size and MD5.\nskip_unchanged: true\nverify_checksum: true\n\n# Replace an existing remote file rather than failing on conflict.\noverwrite: true\n\nretry:\n max_attempts: 5\n base_delay: 1s\n max_delay: 60s\n jitter: 0.25\n\n# Default pruning policy. A file is kept when it satisfies any rule,\n# so this keeps the 14 newest backups plus anything from the last 30\n# days. Omit the whole block to never delete anything.\nretention:\n keep_last: 14\n keep_days: 30\n\nsources:\n - path: /var/backups/postgres\n patterns: [\"*.sql.gz\"]\n exclude: [\"*.part\", \"*.tmp\"]\n remote_subdir: postgres\n\n - path: /var/backups/files\n patterns: [\"*.tar.zst\"]\n recursive: true\n retention:\n keep_last: 7"