3 # Configure & run btrbk & related work on Ian's computers.
4 # Copyright (C) 2024 Ian Kelling
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # SPDX-License-Identifier: GPL-3.0-or-later
22 # todo: if we cancel in the middle of a btrfs send, then run again
23 # immediately, the received subvolume doesn't get a Received UUID:
24 # field, and we won't mount it. Need to figure out a solution that will
28 [[ $EUID == 0 ]] ||
exec sudo
-E "${BASH_SOURCE[0]}" "$@"
30 set -e; .
/usr
/local
/lib
/bash-bear
; set +e
34 btrbk-run [OPTIONS] [run|resume|archive]
35 usually -t TARGET_HOST or -s SOURCE_HOST
37 Note, at source location, intentionally not executable, run and read
41 echo "top of script file:"
42 sed -n '1,/^[# ]*end command line/{p;b};q' "$0"
49 script_name
="${BASH_SOURCE[0]}"
50 script_name
="${script_name##*/}"
52 if $dry_run ||
$conf_only; then
53 printf "$pre dry-run: %s\n" "$*"
55 printf "$pre running: %s\n" "$*"
59 m
() { if $verbose; then printf "$pre %s\n" "$*"; fi; "$@"; }
60 e
() { printf "$pre %s\n" "$*"; }
61 die
() { printf "$pre error: %s\n" "$*" >&2; echo "$pre exiting with status 1" >&2; exit 1; }
62 mexit
() { echo "$pre exiting with status $1"; exit $1; }
64 uninstalled-file-die
() {
65 die
"uninstalled file $1. run install-my-scripts or rerun with -f"
77 if [[ $
(dig +short @
10.2.0.1 -x 10.2.0.2 2>&1 ||
:) == kd.b8.nz.
]] \
78 && ip n show
10.2.0.1 |
grep .
&>/dev
/null
; then
80 elif ping -q -c1 -w1 hal.office.fsf.org
&>/dev
/null \
81 && ip n show
192.168.0.26 |
grep .
&>/dev
/null
; then
88 exit-if-no-default-targets
() {
89 if ! $force && [[ $HOSTNAME != "$MAIL_HOST" ]]; then
90 echo "MAIL_HOST=$MAIL_HOST, nothing to do"
94 kw|kd|frodo|x2|x3|sy
) : ;;
96 die
"error: no default targets for this host, use -t"
103 if ping -q -c1 -w1 x3.office.fsf.org
&>/dev
/null
; then
104 targets
+=(x3.office.fsf.org
)
105 elif ping -q -c1 -w1 $h.b8.nz
&>/dev
/null
; then
106 # in case we took it home
108 elif ping -q -c1 -w1 ${h}w.b8.nz
&>/dev
/null
; then
111 targets
+=(x3wg.b8.nz
)
115 add-wireless-target-h
() {
116 if ping -q -c1 -w1 $h.b8.nz
&>/dev
/null
; then
118 elif ping -q -c1 -w1 ${h}w.b8.nz
&>/dev
/null
; then
119 targets
+=(${h}w.b8.nz
)
126 # q has sensitive data i dont want to backup for so long
127 cat >>/etc
/btrbk
$conf_suf.conf
<<EOF
128 snapshot_preserve $q_preserve
129 snapshot_preserve_min 2h
131 target_preserve $q_preserve
132 target_preserve_min 2h
141 if [[ -e /b
/bash_unpublished
/source-state
]]; then
142 source /b
/bash_unpublished
/source-state
145 # note q is owned by root:1000
154 dry_run
=false
# mostly for testing
156 verbose
=true
; verbose_arg
=-v
158 if [[ $INVOCATION_ID ]]; then
159 # INVOCATION_ID means running as a systemd service. we cant show progress in this case,
160 # but if we pass the arg, it will insert mbuffer into the command.
163 progress_arg
="--progress"
165 incremental_strict
=false
168 default_args_file
=/etc
/btrbk-run.conf
169 if [[ -s $default_args_file ]]; then
170 # shellcheck disable=SC2046 # we want word splitting
171 set -- $
(< $default_args_file) "$@"
172 # i havent used this feature yet, so warn about it
173 echo "$0: warning: default btrbk-run options set in $default_args_file (sleeping 5 seconds):"
174 cat $default_args_file
178 once_args_file
=/etc
/btrbk-run-once.conf
179 if mv -f $once_args_file $once_args_file-tmp 2> >(sed '/No such file or directory/d'); then
180 # shellcheck disable=SC2046 # we want word splitting
181 set -- $
(< $once_args_file-tmp) "$@"
182 # i havent used this feature yet, so warn about it
183 echo "$0: btrbk-run options set in $once_args_file:"
184 cat $once_args_file-tmp
185 rm -f $once_args_file-tmp
193 check_installed
=false
195 temp
=$
(getopt
-l check-installed
,fast
,pull-reexec
,help 23cefikl
:m
:npqrs
:t
:vh
"$@") || usage
1
199 # for the rare case we want to run multiple instances at the same time
202 # only creates the config file, does not run btrbk
203 -c) conf_only
=true
;;
207 # quit early, just btrbk, no extra remounting etc.
209 # avoids some default behaviors:
210 # - no skipping hosts where xprintidle haven't been idle recently
211 # - exit if we can't ssh to 1 or more hosts
212 # - still set default hosts despite MAIL_HOST status
214 # skip various checks. when we run twice in a row for
215 # switch mail-host, no need to repeat the same checks again.
217 -i) incremental_strict
=true
;;
218 # note this implies resume and -p because it is just meant to make
219 # other hosts have the same snapshots, not do any expiry or new
221 -k) kd_spread
=true
;;
222 # bytes per second, suffix k m g
223 -l) rate_limit
=$2; shift ;;
224 # Comma separated mountpoints to backup. This has defaults set below.
225 -m) IFS
=, mountpoints
=($2); unset IFS
; shift ;;
227 # preserve existing snapshots and backups
228 -p) preserve_arg
=-p ;;
229 # internal option for rerunning under newer SOURCE_HOST version.
230 --pull-reexec) pull_reexec
=true
;;
232 -q) verbose
=false
; verbose_arg
=; progress_arg
= ;;
233 # source host to receive a backup from
237 if [[ $source == *:* ]]; then
238 bbksource
="[$source]"
242 # target hosts to send to. empty is valid for just doing local
243 # snapshot. we have default hosts we will populate.
244 -t) IFS
=, targets
=($2); unset IFS
; shift ;;
246 -v) verbose
=true
; verbose_arg
=-v ;;
249 *) die
"Internal error!" ;;
258 if ! $force && { $check_installed ||
[[ ! $source ]]; } ; then
264 for f
in ${install_bin_files[@]}; do
265 if ! diff -q /a
/bin
/ds
/$f /usr
/local
/bin
/$f; then
266 uninstalled-file-die
$f
269 if ! diff -q /a
/bin
/bash-bear-trap
/bash-bear
/usr
/local
/lib
/bash-bear
; then
270 uninstalled-file-die err
272 if $check_installed; then
279 if [[ $cmd_arg && $cmd_arg != resume
]]; then
280 die
"dont pass -k without resume or empty run arg"
282 if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
283 die
"something went wrong, -k not meant to be run on MAIL_HOST"
285 if [[ $HOSTNAME != kd
]]; then
286 die
"something went wrong, -k only meant to run on kd"
291 add-wireless-target-h
294 if [[ ! $cmd_arg ]]; then
299 std_preserve
="36h 14d 8w 24m"
300 q_preserve
="18h 14d 8w"
305 # This works better than the normal archive command. We have to
306 # specify the mount points, but that is what we are used to doing and
307 # we prefer it. Another difference is that archive works recursively
308 # and we don't care about that. Sometimes we may still want to run
309 # btrbk archive, but it doesn't even use the config file, so just
310 # run it directly, eg:
311 # time s btrbk -v archive /mnt/r7/amy/boot/btrbk ssh://bo/mnt/boot2/btrbk
314 std_preserve
="999h 999d 999w 999m"
315 q_preserve
="$std_preserve"
318 *) die
"untested command arg" ;;
321 if (( $# > 1 )); then
322 die
: "only 1 nonoption arg is supported"
325 if [[ -v targets
&& $source ]]; then
326 # note, this doesnt need to be the case, but
327 # we would need to think about it.
328 die
"error: -t and -s are mutually exclusive"
331 ### end options parsing
333 # remove path from earlier version of btrbk
334 rm -f /usr
/sbin
/btrbk
335 # note, this still works as intended if there is no /usr/bin/btrbk
336 if [[ /a
/opt
/btrbk
/btrbk
-nt /usr
/bin
/btrbk
]]; then
337 if [[ -e /b
/distro-functions
/src
/package-manager-abstractions
]]; then
338 .
/b
/distro-functions
/src
/package-manager-abstractions
346 # TODO: i wonder if there should be an option to send to the default
347 # targets, plus any given on the command line.
354 # set default targets
355 if [[ ! -v targets
&& ! $source ]]; then
356 exit-if-no-default-targets
359 if ! $kd_spread && [[ $HOSTNAME != x3
]]; then
362 if [[ $HOSTNAME != kd
]]; then
365 wireless_home_hosts
=(
369 for h
in ${wireless_home_hosts[@]}; do
370 if [[ $HOSTNAME != "$h" ]]; then
371 add-wireless-target-h
376 for h
in x2 x3 kw
; do
377 if [[ $HOSTNAME == "$h" ]]; then
380 if ping -q -c1 -w1 $h.office.fsf.org
&>/dev
/null
; then
381 targets
+=($h.office.fsf.org
)
389 if [[ ${mountpoints[0]} ]]; then
390 for mp
in ${mountpoints[@]}; do
391 if [[ -e /nocow
/btrfs-stale
/$mp ]]; then
392 die
"error: $mp is stale, mount-latest-subvol first"
396 # set default mountpoints
397 if [[ ${targets[0]} == tp
]]; then
403 if [[ $source ]]; then
404 source_state
="$(ssh $source 'cat /a/bin/bash_unpublished/source-state; echo source_host=$HOSTNAME')"
406 # shellcheck disable=SC2154 # assigned in the above eval.
407 if [[ $source_host == "$MAIL_HOST" ]]; then
408 prospective_mps
+=(/o
)
410 if [[ $source_host == "$HOST2" ]]; then
411 prospective_mps
+=(/a
/qr
/qd
/q
)
414 if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
415 prospective_mps
+=(/o
)
417 if [[ $HOSTNAME == "$HOST2" ]]; then
418 prospective_mps
+=(/a
/qr
/qd
/q
)
421 prospective_mps
=(/a
/o
/qr
/qd
/q
)
424 # note: put q last just in case its specific retention options were to
425 # affect other config sections. I havent tested if that is the case.
429 for mp
in ${prospective_mps[@]}; do # default mountpoints to sync
430 if [[ -e /nocow
/btrfs-stale
/$mp ]]; then
431 e
"warning: $mp stale, not adding to default mountpoints"
434 if awk '{print $2}' /etc
/fstab |
grep -xF $mp &>/dev
/null
; then
440 tmp
=$
(( ${#mountpoints[@]} == 0 ))
442 die didnt get mountpoint arg and had no defaults
445 ##### end command line parsing ########
447 #### begin pre-checks #####
449 # todo: this has a timing problem, since btrbk.timer could activate the service after this check.
450 if ! $fast && [[ $source ]]; then
451 if [[ $
(ssh $source ps
--no-headers -o comm 1) == systemd
]]; then
452 status
=$
(ssh $source systemctl is-active btrbk.service
) ||
: # normally returns 3
454 inactive|failed
) : ;;
456 echo "$0: error: btrbk is running on source. exiting out of caution"
462 if ! command -v btrbk
&>/dev
/null
; then
463 die
"error: no btrbk binary found"
466 if ! $pull_reexec && [[ $source ]] && $pulla && ! $force ; then
467 ssh root@
$source btrbk-run
--check-installed ||
exit 1
470 #### end pre-checks #####
474 mkdir
-p /var
/log
/btrbk
475 # The journal doesnt go back to my oldest backups, and I've found myself
476 # wanting older logs. Not going to bother expiring old logs, since it is
477 # fine if they go back years.
478 log_path
=/var
/log
/btrbk
/$
(date +%F_
%T
%:::z
).log
479 echo copying output to
$log_path
480 exec &> >(pee
cat 'ts "%F %T"|dd of='$log_path' status=none')
482 # print some non-default opts
485 if ! $conf_only; then
486 opts_show
+=(conf_only
=true
)
489 opts_show
+=(dry_run
=true
)
491 if [[ $rate_limit != no
]]; then
492 opts_show
+=("rate_limit=$rate_limit")
494 if [[ $cmd_arg != run
]]; then
495 opts_show
+=(cmd_arg
=$cmd_arg)
497 if (( ${#opts_show[@]} >= 1 )); then
499 for opt
in ${opts_show[@]}; do
510 if [[ -v targets
]]; then
511 echo "targets: ${targets[*]}"
514 if [[ $source ]]; then
515 echo "source: $source"
518 echo "mountpoints: ${mountpoints[*]}"
521 # pull_reexec stops us from getting into an infinite loop if there is some
522 # kind of weird problem
524 for m
in "${mountpoints[@]}"; do
525 if [[ $m == /a
]]; then
531 if ! $pull_reexec && [[ $source ]] && $pulla ; then
533 m rsync
-ra $source:/usr
/local
/bin
/{mount-latest-subvol
,check-subvol-stale
} /usr
/local
/bin
534 m rsync
-ra $source:/usr
/local
/lib
/bash-bear
/usr
/local
/lib
535 m scp
$source:/a
/bin
/distro-setup
/btrbk-run
$tmpf
536 if ! diff -q $tmpf ${BASH_SOURCE[0]}; then
537 e
"found different version on host $source. reexecing"
538 install -T $tmpf /usr
/local
/bin
/btrbk-run
539 m
/usr
/local
/bin
/btrbk-run
--pull-reexec "${orig_args[@]}"
546 # if our mountpoints are from stale snapshots,
547 # it doesn't make sense to do a backup.
548 m check-subvol-stale
${mountpoints[@]} || die
"found stale mountpoints in ${mountpoints[*]}"
550 # for an initial run, btrbk requires the dir to exist.
551 mkdir
-p /mnt
/{root
,o
}/btrbk
553 local_zone
=$
(date +%z
)
555 if [[ $source ]]; then
559 if ! zone
=$
(ssh root@
$source date +%z
); then
561 echo "$0: warning: failed to ssh to root@$source"
563 die failed to
ssh to root@
$source
566 if [[ $zone != "$local_zone" ]]; then
567 die
"error: dont confuse yourself with multiple time zones. $h has different timezone than localhost"
574 for h
in ${targets[@]}; do
575 if $fast ||
$conf_only; then
576 # Use some typical values in this case
577 root_size
=$
(( 1024 * 1024 * 2000 )) #2tb
580 elif remote_str
=$
(timeout
-s 9 6 ssh root@
$h "mkdir -p /mnt/root/btrbk /mnt/o/btrbk && date +%z && df --output=size,pcent / | tail -n1"); then
581 mapfile
-t tmp_array
<<<"$remote_str"
582 zone
="${tmp_array[0]}"
583 IFS
=" " read -r root_size percent_used
<<<"${tmp_array[1]}"
584 percent_used
=${percent_used%%%}
586 tmp
=$
(( ${#tmp_array[@]} != 2 ))
588 die
"error: didnt get 2 lines in test ssh to target $h. investigate"
590 case $percent_used in
591 [0-9]|
[1-9][0-9]) : ;;
593 die
"error: didnt get percent disk use in test ssh to target $h. investigate"
601 # we may be booted into a bootstrap fs or something
602 min_root_kb
=$
(( 1024 * 1024 * 200 )) # 200 gb
603 tmp
=$
(( root_size
< min_root_kb
))
608 tmp
=$
(( percent_used
>= 98 ))
610 die
"error: filesystem on target $h is $percent_used % full"
613 # on sy, xprintidle is resetting every 12 seconds even when not
614 # idle, i dunno why, instead we are checking if the screen is locked,
615 # which is good enough.
617 # This is a separate ssh because the command can fail and thatis ok.
620 if lock_info
=$
(timeout
-s 9 6 ssh $h DISPLAY
=:0 xscreensaver-command
-time); then
621 if [[ $lock_info != *non-blanked
* ]]; then
628 # Ignore this host. i sometimes use a non-main machine for
629 # testing or web browsing, knowing that everything will be wiped
630 # by the next backup, but I dont want it to happen as Im using
632 e
"warning: $h: seems to be actively in use, skipping for now"
637 if [[ $zone != "$local_zone" ]]; then
638 die
"error: dont confuse yourself with multiple time zones. $h has different timezone than localhost"
641 if [[ ! ${sshable[*]} ]] || { $force && [[ ${sshfail[*]} ]]; }; then
642 die
"failed to ssh to hosts: ${sshfail[*]}"
644 if [[ ${sshfail[*]} ]]; then
646 e
"error: failed to ssh to ${sshfail[*]} but continuing with other hosts"
648 targets
=(${sshable[@]})
653 cat >/etc
/btrbk
$conf_suf.conf
<<EOF
654 ssh_identity /q/root/h
655 #ssh_identity /root/.ssh/home
657 # Just a guess that local7 is a good facility to pick.
658 # It's a bit odd that the transaction log has to be logged to
659 # a file or syslog, while other output is sent to std out.
660 # The man does not mention a way for them to be together, but
661 # I dunno if setting a log level like warn might also output
663 transaction_syslog local7
666 #stream_compress zstd
668 # so we only run one at a time
669 lockfile /var/lock/btrbk$conf_suf.lock
671 # default format of short does not accomidate hourly preservation setting
672 timestamp_format long-iso
674 # only make a snapshot if things have changed
675 snapshot_create onchange
676 # I could make this different from target_preserve,
677 # if one disk had less space.
678 # for now, keeping them equal.
679 snapshot_preserve $std_preserve
680 snapshot_preserve_min 6h
682 # so, total backups = ~58
683 target_preserve $std_preserve
684 target_preserve_min 6h
686 # it seems very likely that not doing this could result in clone source not found
687 # errors, for example when expiry happens differently on different hosts,
688 # also, as btrbk does by default, if a failed send happens, on the next run it
689 # will warn about a stray subvolume, but then create a backup of a newer subvol
690 # and use an older subvol as the parent.
691 incremental_prefs sao:1
693 # if something fails and it's not obvious, try doing
694 # btrbk -l debug -v dryrun
696 rate_limit $rate_limit
699 if $incremental_strict; then
700 cat >>/etc
/btrbk
$conf_suf.conf
<<EOF
707 mp_count
=${#mountpoints[@]}
708 for (( i
=0; i
< mp_count
- 1 ; i
++ )); do
709 if [[ ${mountpoints[i]} == /q
]]; then
710 unset "mountpoints[i]"
719 declare -A source_snaps
721 for m
in ${mountpoints[@]}; do
732 snap_list_cmds
+=("echo $vol/btrbk/$sub.*;")
734 if [[ $source ]]; then
735 tmp_a
=($vol/btrbk
/$sub.
*)
736 tg_snaps
+=("${tmp_a[*]}")
737 cat >>/etc
/btrbk
$conf_suf.conf
<<EOF
738 volume ssh://$bbksource$vol
742 cat >>/etc
/btrbk
$conf_suf.conf
<<EOF
743 target send-receive $vol/btrbk
745 else # we have targets
746 for snap
in "$vol/btrbk/$sub."*; do
747 source_snaps
[$snap]=t
750 cat >>/etc
/btrbk
$conf_suf.conf
<<EOF
755 for tg
in ${targets[@]}; do
757 if [[ $tg == *:* ]]; then
760 cat >>/etc
/btrbk
$conf_suf.conf
<<EOF
761 target send-receive ssh://$tg$vol/btrbk
767 # Delete any subvols on the receiving host that don't exist on the
768 # sending host. Otherwise, the receiving host could have snapshots that
769 # aren't on the sending side, and thus become odd leaf subvols, and then
770 # btrbk could try to use them when we sync back, creating a weird tree
771 # instead of linear parent/child relationship. Maybe this could lead to
772 # a missing source subvol error, so lets avoid it.
774 get-orphan-tg-snaps
() {
776 for (( i
=0; i
< ${#mountpoints[@]}; i
++ )); do
777 orphan_start_count
=${#orphan_tg_snaps[@]}
779 for tg_snap
in ${tg_snaps[$i]}; do
780 tg_snap_count
=$
(( tg_snap_count
+ 1 ))
781 if [[ ! ${source_snaps[$tg_snap]} ]]; then
782 orphan_tg_snaps
+=("$tg_snap")
785 orphan_mp_count
=$
(( ${#orphan_tg_snaps[@]} - orphan_start_count
))
787 tmp
=$
(( tg_snap_count
> 1 && tg_snap_count
== orphan_mp_count
))
789 die
"something went wrong checking orphans on $tg: for mountpoint ${mountpoints[$i]}, $orphan_mp_count"
794 if [[ $source ]]; then
795 for snap
in $
(ssh root@
$source "shopt -s nullglob; ${snap_list_cmds[*]}"); do
796 source_snaps
[$snap]=t
799 tmp
=$
(( ${#orphan_tg_snaps[*]} >= 1 ))
801 d btrfs sub del
${orphan_tg_snaps[*]}
803 else # we have targets
804 for tg
in ${targets[@]}; do
805 tmp_str
=$
(ssh root@
$tg "shopt -s nullglob; ${snap_list_cmds[*]}")
806 mapfile
-t tg_snaps
<<<"$tmp_str"
808 tmp
=$
(( ${#orphan_tg_snaps[*]} >= 1 ))
810 d
ssh root@
$tg "btrfs sub del ${orphan_tg_snaps[*]}"
815 # todo: umount first to ensure we don't have any errors
816 # todo: do some kill fuser stuff to make umount more reliable
826 m btrbk
-c /etc
/btrbk
$conf_suf.conf
-v -n $cmd_arg
829 # -q and just using the syslog option seemed nice,
830 # but it doesn't show when a send has a parent and when it doesn't.
831 m btrbk
-c /etc
/btrbk
$conf_suf.conf
$preserve_arg $verbose_arg $progress_arg $cmd_arg
837 # todo: tp not valid anymore.
838 # if we have it, sync to systems which don't
839 if mountpoint
$rsync_mountpoint >/dev
/null
; then
840 for tg
in ${targets[@]}; do
843 dirs=(/p
/c
/machine_specific
/tp
)
844 for x
in /p
/c
/machine_specific
/*.hosts
; do
845 if grep -qxF $tg $x; then
849 m rsync
-aSAXPH --specials --devices --delete --relative ${dirs[@]} root@
$tg:/
856 for mp
in "${mountpoints[@]}"; do
857 subvols
+=("${mp##*/}")
859 if [[ $source ]]; then
860 m mount-latest-subvol
"${subvols[@]}"
862 for tg
in ${targets[@]}; do
863 m
/a
/exe
/mount-latest-remote
"$tg" "${subvols[@]}" || ret
=$?
867 # todo, we get hostnames earlier, reuse that.
868 if [[ $ret == 0 ]]; then
869 for tg
in ${targets[@]}; do
870 h
=$
(ssh $tg hostname
)
871 if [[ $h == kd
&& $HOSTNAME == x3
&& $HOSTNAME == "$MAIL_HOST" ]]; then
872 m
ssh root@
$tg 'btrbk-spread-wrap &>/dev/null </dev/null &'
874 rsync
--mkpath -a -f"- */" -f"+ *" /var
/log
/btrbk
/ root@
$tg:/var
/log
/btrbk
/$tg
875 ssh root@
$tg /usr
/local
/bin
/mail-backup-clean
877 if [[ $source ]]; then
878 rsync
--mkpath -a -f"- */" -f"+ *" $source:/var
/log
/btrbk
/ /var
/log
/btrbk
/$source
884 # todo: move variable data we don't care about backing up
885 # to /nocow and symlink it.
888 # background on btrbk timezones. with short/long, timestamps use local time.
889 # for long, if your local time moves backwards, by moving timezones or
890 # for an hour when daylight savings changes it, you will temporarily get
891 # a more aggressive retention policy for the overlapping period, and
892 # vice versa for the opposite timezone move. The alternative is using
893 # long-iso, which puts timezone info into the timestamp, which means
894 # that instead of shifting time, you shift the start of day/week/month
895 # which is used for retention to your new local time, which means for
896 # example, if you moved forward by 8 hours, the daily/weekly/monthly
897 # retention will be 8 hours more aggressive since midnight is at a new
898 # time, unless you fake the timzeone using the TZ env variable.
899 # However, in the short term, there will be no inconsistencies.
900 # I don't see any problem with shifting when the day starts for
901 # retention, so I'm using long-iso.
903 # note to create a long-iso timestamp: date +%Y%m%dT%H%M%S%z