kopia icon indicating copy to clipboard operation
kopia copied to clipboard

Suppressing output and disabling progress with repository sync-to

Open valankar opened this issue 2 years ago • 3 comments

I can't figure out how to make the output of kopia using repository sync-to quiet, disabling the progress bar, and only outputting errors. This is so I can use it in a crontab/script and only output errors. I tried:

kopia repository sync-to sftp ... --no-progress --log-level=error

But it doesn't seem to change much and still outputs 'Found N BLOBs in the destination...'. What's the proper way to make this quiet and only output errors?

valankar avatar Dec 27 '23 01:12 valankar

@valankar Did you ever figure it out? I'm having the same issue with sync-to filesystem.

ethauvin avatar Jan 29 '24 08:01 ethauvin

Unfortunately not.

valankar avatar Feb 01 '24 17:02 valankar

Would be great to get the outputs of this to be properly cron-friendly. This is the disgusting kludge I've been using for sync-to cronjob:

chronic bash -c "set -o pipefail; { kopia repository sync-to filesystem --path /mnt/kopiabackup --delete --must-exist 3>&1 1>&2 2>&3- | tee -a /var/log/kopiabackup.log;} 3>&1 1>&2 2>&3- | tee -a /var/log/kopiabackup.log"

This will redirect STDOUT and STDERR to a log file and pass them through to chronic which will suppress cron email output unless there are log messages on STDERR or return code is non-zero.

STDOUT/STDERR redirection: https://stackoverflow.com/questions/363223/how-do-i-get-both-stdout-and-stderr-to-go-to-the-terminal-and-a-log-file/59435204#59435204

Use of pipefail to propagate the kopia exit code up to chronic instead of using exit code of tee: https://stackoverflow.com/questions/6871859/piping-command-output-to-tee-but-also-save-exit-code-of-command/6872163#6872163

phobozad avatar Feb 20 '24 05:02 phobozad