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
35 btrbk-run [OPTIONS] [run|resume|archive]
36 usually -t TARGET_HOST or -s SOURCE_HOST
38 Note, at source location, intentionally not executable, run and read
42 echo "top of script file:"
43 sed -n '1,/^[# ]*end command line/{p;b};q' "$0"
50 script_name
="${BASH_SOURCE[0]}"
51 script_name
="${script_name##*/}"
53 if $dry_run ||
$conf_only; then
54 printf "$pre dry-run: %s\n" "$*"
56 printf "$pre running: %s\n" "$*"
60 m
() { if $verbose; then printf "$pre %s\n" "$*"; fi; "$@"; }
61 e
() { printf "$pre %s\n" "$*"; }
62 die
() { printf "$pre error: %s\n" "$*" >&2; echo "$pre exiting with status 1" >&2; exit 1; }
63 mexit
() { echo "$pre exiting with status $1"; exit $1; }
65 uninstalled-file-die
() {
66 die
"uninstalled file $1. run install-my-scripts or rerun with -f"
78 if [[ $
(dig +short @
10.2.0.1 -x 10.2.0.2 2>&1 ||
:) == kd.b8.nz.
]] \
79 && ip n show
10.2.0.1 |
grep .
&>/dev
/null
; then
81 elif ping -q -c1 -w1 hal.office.fsf.org
&>/dev
/null \
82 && ip n show
192.168.0.26 |
grep .
&>/dev
/null
; then
89 exit-if-no-default-targets
() {
90 if ! $force && [[ $HOSTNAME != "$MAIL_HOST" ]]; then
91 echo "MAIL_HOST=$MAIL_HOST, nothing to do"
95 kw|kd|frodo|x2|x3|sy
) : ;;
97 die
"error: no default targets for this host, use -t"
104 if ping -q -c1 -w1 x3.office.fsf.org
&>/dev
/null
; then
105 targets
+=(x3.office.fsf.org
)
106 elif ping -q -c1 -w1 $h.b8.nz
&>/dev
/null
; then
107 # in case we took it home
109 elif ping -q -c1 -w1 ${h}w.b8.nz
&>/dev
/null
; then
112 targets
+=(x3wg.b8.nz
)
116 add-wireless-target-h
() {
117 if ping -q -c1 -w1 $h.b8.nz
&>/dev
/null
; then
119 elif ping -q -c1 -w1 ${h}w.b8.nz
&>/dev
/null
; then
120 targets
+=(${h}w.b8.nz
)
127 # q has sensitive data i dont want to backup for so long
128 cat >>/etc
/btrbk
$conf_suf.conf
<<EOF
129 snapshot_preserve $q_preserve
130 snapshot_preserve_min 2h
132 target_preserve $q_preserve
133 target_preserve_min 2h
142 if [[ -e /b
/bash_unpublished
/source-state
]]; then
143 source /b
/bash_unpublished
/source-state
146 # note q is owned by root:1000
155 dry_run
=false
# mostly for testing
157 verbose
=true
; verbose_arg
=-v
159 if [[ $INVOCATION_ID ]]; then
160 # INVOCATION_ID means running as a systemd service. we cant show progress in this case,
161 # but if we pass the arg, it will insert mbuffer into the command.
164 progress_arg
="--progress"
166 incremental_strict
=false
169 default_args_file
=/etc
/btrbk-run.conf
170 if [[ -s $default_args_file ]]; then
171 # shellcheck disable=SC2046 # we want word splitting
172 set -- $
(< $default_args_file) "$@"
173 # i havent used this feature yet, so warn about it
174 echo "$0: warning: default btrbk-run options set in $default_args_file (sleeping 5 seconds):"
175 cat $default_args_file
179 once_args_file
=/etc
/btrbk-run-once.conf
180 if mv -f $once_args_file $once_args_file-tmp 2> >(sed '/No such file or directory/d'); then
181 # shellcheck disable=SC2046 # we want word splitting
182 set -- $
(< $once_args_file-tmp) "$@"
183 # i havent used this feature yet, so warn about it
184 echo "$0: btrbk-run options set in $once_args_file:"
185 cat $once_args_file-tmp
186 rm -f $once_args_file-tmp
194 check_installed
=false
196 temp
=$
(getopt
-l check-installed
,fast
,pull-reexec
,help 23cefikl
:m
:npqrs
:t
:vh
"$@") || usage
1
200 # for the rare case we want to run multiple instances at the same time
203 # only creates the config file, does not run btrbk
204 -c) conf_only
=true
;;
208 # quit early, just btrbk, no extra remounting etc.
210 # avoids some default behaviors:
211 # - no skipping hosts where xprintidle haven't been idle recently
212 # - exit if we can't ssh to 1 or more hosts
213 # - still set default hosts despite MAIL_HOST status
215 # skip various checks. when we run twice in a row for
216 # switch mail-host, no need to repeat the same checks again.
218 -i) incremental_strict
=true
;;
219 # note this implies resume and -p because it is just meant to make
220 # other hosts have the same snapshots, not do any expiry or new
222 -k) kd_spread
=true
;;
223 # bytes per second, suffix k m g
224 -l) rate_limit
=$2; shift ;;
225 # Comma separated mountpoints to backup. This has defaults set below.
226 -m) IFS
=, mountpoints
=($2); unset IFS
; shift ;;
228 # preserve existing snapshots and backups
229 -p) preserve_arg
=-p ;;
230 # internal option for rerunning under newer SOURCE_HOST version.
231 --pull-reexec) pull_reexec
=true
;;
233 -q) verbose
=false
; verbose_arg
=; progress_arg
= ;;
234 # source host to receive a backup from
238 if [[ $source == *:* ]]; then
239 bbksource
="[$source]"
243 # target hosts to send to. empty is valid for just doing local
244 # snapshot. we have default hosts we will populate.
245 -t) IFS
=, targets
=($2); unset IFS
; shift ;;
247 -v) verbose
=true
; verbose_arg
=-v ;;
250 *) die
"Internal error!" ;;
259 if ! $force && { $check_installed ||
[[ ! $source ]]; } ; then
265 for f
in ${install_bin_files[@]}; do
266 if ! diff -q /a
/bin
/ds
/$f /usr
/local
/bin
/$f; then
267 uninstalled-file-die
$f
270 if ! diff -q /a
/bin
/bash-bear-trap
/bash-bear
/usr
/local
/lib
/bash-bear
; then
271 uninstalled-file-die err
273 if $check_installed; then
280 if [[ $cmd_arg && $cmd_arg != resume
]]; then
281 die
"dont pass -k without resume or empty run arg"
283 if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
284 die
"something went wrong, -k not meant to be run on MAIL_HOST"
286 if [[ $HOSTNAME != kd
]]; then
287 die
"something went wrong, -k only meant to run on kd"
292 add-wireless-target-h
295 if [[ ! $cmd_arg ]]; then
300 std_preserve
="36h 14d 8w 24m"
301 q_preserve
="18h 14d 8w"
306 # This works better than the normal archive command. We have to
307 # specify the mount points, but that is what we are used to doing and
308 # we prefer it. Another difference is that archive works recursively
309 # and we don't care about that. Sometimes we may still want to run
310 # btrbk archive, but it doesn't even use the config file, so just
311 # run it directly, eg:
312 # time s btrbk -v archive /mnt/r7/amy/boot/btrbk ssh://bo/mnt/boot2/btrbk
315 std_preserve
="999h 999d 999w 999m"
316 q_preserve
="$std_preserve"
319 *) die
"untested command arg" ;;
322 if (( $# > 1 )); then
323 die
: "only 1 nonoption arg is supported"
326 if [[ -v targets
&& $source ]]; then
327 # note, this doesnt need to be the case, but
328 # we would need to think about it.
329 die
"error: -t and -s are mutually exclusive"
332 ### end options parsing
334 # remove path from earlier version of btrbk
335 rm -f /usr
/sbin
/btrbk
336 # note, this still works as intended if there is no /usr/bin/btrbk
337 if [[ /a
/opt
/btrbk
/btrbk
-nt /usr
/bin
/btrbk
]]; then
338 if [[ -e /b
/distro-functions
/src
/package-manager-abstractions
]]; then
339 .
/b
/distro-functions
/src
/package-manager-abstractions
347 # TODO: i wonder if there should be an option to send to the default
348 # targets, plus any given on the command line.
355 # set default targets
356 if [[ ! -v targets
&& ! $source ]]; then
357 exit-if-no-default-targets
360 if ! $kd_spread && [[ $HOSTNAME != x3
]]; then
363 if [[ $HOSTNAME != kd
]]; then
366 wireless_home_hosts
=(
370 for h
in ${wireless_home_hosts[@]}; do
371 if [[ $HOSTNAME != "$h" ]]; then
372 add-wireless-target-h
377 for h
in x2 x3 kw
; do
378 if [[ $HOSTNAME == "$h" ]]; then
381 if ping -q -c1 -w1 $h.office.fsf.org
&>/dev
/null
; then
382 targets
+=($h.office.fsf.org
)
390 if [[ ${mountpoints[0]} ]]; then
391 for mp
in ${mountpoints[@]}; do
392 if [[ -e /nocow
/btrfs-stale
/$mp ]]; then
393 die
"error: $mp is stale, mount-latest-subvol first"
397 # set default mountpoints
398 if [[ ${targets[0]} == tp
]]; then
404 if [[ $source ]]; then
405 source_state
="$(ssh $source 'cat /a/bin/bash_unpublished/source-state; echo source_host=$HOSTNAME')"
407 # shellcheck disable=SC2154 # assigned in the above eval.
408 if [[ $source_host == "$MAIL_HOST" ]]; then
409 prospective_mps
+=(/o
)
411 if [[ $source_host == "$HOST2" ]]; then
412 prospective_mps
+=(/a
/qr
/qd
/q
)
415 if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
416 prospective_mps
+=(/o
)
418 if [[ $HOSTNAME == "$HOST2" ]]; then
419 prospective_mps
+=(/a
/qr
/qd
/q
)
422 prospective_mps
=(/a
/o
/qr
/qd
/q
)
425 # note: put q last just in case its specific retention options were to
426 # affect other config sections. I havent tested if that is the case.
430 for mp
in ${prospective_mps[@]}; do # default mountpoints to sync
431 if [[ -e /nocow
/btrfs-stale
/$mp ]]; then
432 e
"warning: $mp stale, not adding to default mountpoints"
435 if awk '{print $2}' /etc
/fstab |
grep -xF $mp &>/dev
/null
; then
441 tmp
=$
(( ${#mountpoints[@]} == 0 ))
443 die didnt get mountpoint arg and had no defaults
446 ##### end command line parsing ########
448 #### begin pre-checks #####
450 # todo: this has a timing problem, since btrbk.timer could activate the service after this check.
451 if ! $fast && [[ $source ]]; then
452 if [[ $
(ssh $source ps
--no-headers -o comm 1) == systemd
]]; then
453 status
=$
(ssh $source systemctl is-active btrbk.service
) ||
: # normally returns 3
455 inactive|failed
) : ;;
457 echo "$0: error: btrbk is running on source. exiting out of caution"
463 if ! command -v btrbk
&>/dev
/null
; then
464 die
"error: no btrbk binary found"
467 if ! $pull_reexec && [[ $source ]] && $pulla && ! $force ; then
468 ssh root@
$source btrbk-run
--check-installed ||
exit 1
471 #### end pre-checks #####
475 mkdir
-p /var
/log
/btrbk
476 # The journal doesnt go back to my oldest backups, and I've found myself
477 # wanting older logs. Not going to bother expiring old logs, since it is
478 # fine if they go back years.
479 log_path
=/var
/log
/btrbk
/$
(date +%F_
%T
%:::z
).log
480 echo copying output to
$log_path
481 exec &> >(pee
cat 'ts "%F %T"|dd of='$log_path' status=none')
483 # print some non-default opts
486 if ! $conf_only; then
487 opts_show
+=(conf_only
=true
)
490 opts_show
+=(dry_run
=true
)
492 if [[ $rate_limit != no
]]; then
493 opts_show
+=("rate_limit=$rate_limit")
495 if [[ $cmd_arg != run
]]; then
496 opts_show
+=(cmd_arg
=$cmd_arg)
498 if (( ${#opts_show[@]} >= 1 )); then
500 for opt
in ${opts_show[@]}; do
511 if [[ -v targets
]]; then
512 echo "targets: ${targets[*]}"
515 if [[ $source ]]; then
516 echo "source: $source"
519 echo "mountpoints: ${mountpoints[*]}"
522 # pull_reexec stops us from getting into an infinite loop if there is some
523 # kind of weird problem
525 for m
in "${mountpoints[@]}"; do
526 if [[ $m == /a
]]; then
532 if ! $pull_reexec && [[ $source ]] && $pulla ; then
534 m rsync
-ra $source:/usr
/local
/bin
/{mount-latest-subvol
,check-subvol-stale
} /usr
/local
/bin
535 m rsync
-ra $source:/usr
/local
/lib
/bash-bear
/usr
/local
/lib
536 m scp
$source:/a
/bin
/distro-setup
/btrbk-run
$tmpf
537 if ! diff -q $tmpf ${BASH_SOURCE[0]}; then
538 e
"found different version on host $source. reexecing"
539 install -T $tmpf /usr
/local
/bin
/btrbk-run
540 m
/usr
/local
/bin
/btrbk-run
--pull-reexec "${orig_args[@]}"
547 # if our mountpoints are from stale snapshots,
548 # it doesn't make sense to do a backup.
549 m check-subvol-stale
${mountpoints[@]} || die
"found stale mountpoints in ${mountpoints[*]}"
551 # for an initial run, btrbk requires the dir to exist.
552 mkdir
-p /mnt
/{root
,o
}/btrbk
554 local_zone
=$
(date +%z
)
556 if [[ $source ]]; then
560 if ! zone
=$
(ssh root@
$source date +%z
); then
562 echo "$0: warning: failed to ssh to root@$source"
564 die failed to
ssh to root@
$source
567 if [[ $zone != "$local_zone" ]]; then
568 die
"error: dont confuse yourself with multiple time zones. $h has different timezone than localhost"
575 for h
in ${targets[@]}; do
576 if $fast ||
$conf_only; then
577 # Use some typical values in this case
578 root_size
=$
(( 1024 * 1024 * 2000 )) #2tb
581 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
582 mapfile
-t tmp_array
<<<"$remote_str"
583 zone
="${tmp_array[0]}"
584 IFS
=" " read -r root_size percent_used
<<<"${tmp_array[1]}"
585 percent_used
=${percent_used%%%}
587 tmp
=$
(( ${#tmp_array[@]} != 2 ))
589 die
"error: didnt get 2 lines in test ssh to target $h. investigate"
591 case $percent_used in
592 [0-9]|
[1-9][0-9]) : ;;
594 die
"error: didnt get percent disk use in test ssh to target $h. investigate"
602 # we may be booted into a bootstrap fs or something
603 min_root_kb
=$
(( 1024 * 1024 * 200 )) # 200 gb
604 tmp
=$
(( root_size
< min_root_kb
))
609 tmp
=$
(( percent_used
>= 98 ))
611 die
"error: filesystem on target $h is $percent_used % full"
614 # on sy, xprintidle is resetting every 12 seconds even when not
615 # idle, i dunno why, instead we are checking if the screen is locked,
616 # which is good enough.
618 # This is a separate ssh because the command can fail and thatis ok.
621 if lock_info
=$
(timeout
-s 9 6 ssh $h DISPLAY
=:0 xscreensaver-command
-time); then
622 if [[ $lock_info != *non-blanked
* ]]; then
629 # Ignore this host. i sometimes use a non-main machine for
630 # testing or web browsing, knowing that everything will be wiped
631 # by the next backup, but I dont want it to happen as Im using
633 e
"warning: $h: seems to be actively in use, skipping for now"
638 if [[ $zone != "$local_zone" ]]; then
639 die
"error: dont confuse yourself with multiple time zones. $h has different timezone than localhost"
642 if [[ ! ${sshable[*]} ]] || { $force && [[ ${sshfail[*]} ]]; }; then
643 die
"failed to ssh to hosts: ${sshfail[*]}"
645 if [[ ${sshfail[*]} ]]; then
647 e
"error: failed to ssh to ${sshfail[*]} but continuing with other hosts"
649 targets
=(${sshable[@]})
654 cat >/etc
/btrbk
$conf_suf.conf
<<EOF
655 ssh_identity /q/root/h
656 #ssh_identity /root/.ssh/home
658 # Just a guess that local7 is a good facility to pick.
659 # It's a bit odd that the transaction log has to be logged to
660 # a file or syslog, while other output is sent to std out.
661 # The man does not mention a way for them to be together, but
662 # I dunno if setting a log level like warn might also output
664 transaction_syslog local7
667 #stream_compress zstd
669 # so we only run one at a time
670 lockfile /var/lock/btrbk$conf_suf.lock
672 # default format of short does not accomidate hourly preservation setting
673 timestamp_format long-iso
675 # only make a snapshot if things have changed
676 snapshot_create onchange
677 # I could make this different from target_preserve,
678 # if one disk had less space.
679 # for now, keeping them equal.
680 snapshot_preserve $std_preserve
681 snapshot_preserve_min 6h
683 # so, total backups = ~58
684 target_preserve $std_preserve
685 target_preserve_min 6h
687 # it seems very likely that not doing this could result in clone source not found
688 # errors, for example when expiry happens differently on different hosts,
689 # also, as btrbk does by default, if a failed send happens, on the next run it
690 # will warn about a stray subvolume, but then create a backup of a newer subvol
691 # and use an older subvol as the parent.
692 incremental_prefs sao:1
694 # if something fails and it's not obvious, try doing
695 # btrbk -l debug -v dryrun
697 rate_limit $rate_limit
700 if $incremental_strict; then
701 cat >>/etc
/btrbk
$conf_suf.conf
<<EOF
708 mp_count
=${#mountpoints[@]}
709 for (( i
=0; i
< mp_count
- 1 ; i
++ )); do
710 if [[ ${mountpoints[i]} == /q
]]; then
711 unset "mountpoints[i]"
720 declare -A source_snaps
722 for m
in ${mountpoints[@]}; do
733 snap_list_cmds
+=("echo $vol/btrbk/$sub.*;")
735 if [[ $source ]]; then
736 tmp_a
=($vol/btrbk
/$sub.
*)
737 tg_snaps
+=("${tmp_a[*]}")
738 cat >>/etc
/btrbk
$conf_suf.conf
<<EOF
739 volume ssh://$bbksource$vol
743 cat >>/etc
/btrbk
$conf_suf.conf
<<EOF
744 target send-receive $vol/btrbk
746 else # we have targets
747 for snap
in "$vol/btrbk/$sub."*; do
748 source_snaps
[$snap]=t
751 cat >>/etc
/btrbk
$conf_suf.conf
<<EOF
756 for tg
in ${targets[@]}; do
758 if [[ $tg == *:* ]]; then
761 cat >>/etc
/btrbk
$conf_suf.conf
<<EOF
762 target send-receive ssh://$tg$vol/btrbk
768 # Delete any subvols on the receiving host that don't exist on the
769 # sending host. Otherwise, the receiving host could have snapshots that
770 # aren't on the sending side, and thus become odd leaf subvols, and then
771 # btrbk could try to use them when we sync back, creating a weird tree
772 # instead of linear parent/child relationship. Maybe this could lead to
773 # a missing source subvol error, so lets avoid it.
775 get-orphan-tg-snaps
() {
777 for (( i
=0; i
< ${#mountpoints[@]}; i
++ )); do
778 orphan_start_count
=${#orphan_tg_snaps[@]}
780 for tg_snap
in ${tg_snaps[$i]}; do
781 tg_snap_count
=$
(( tg_snap_count
+ 1 ))
782 if [[ ! ${source_snaps[$tg_snap]} ]]; then
783 orphan_tg_snaps
+=("$tg_snap")
786 orphan_mp_count
=$
(( ${#orphan_tg_snaps[@]} - orphan_start_count
))
788 tmp
=$
(( tg_snap_count
> 1 && tg_snap_count
== orphan_mp_count
))
790 die
"something went wrong checking orphans on $tg: for mountpoint ${mountpoints[$i]}, $orphan_mp_count"
795 if [[ $source ]]; then
796 for snap
in $
(ssh root@
$source "shopt -s nullglob; ${snap_list_cmds[*]}"); do
797 source_snaps
[$snap]=t
800 tmp
=$
(( ${#orphan_tg_snaps[*]} >= 1 ))
802 d btrfs sub del
${orphan_tg_snaps[*]}
804 else # we have targets
805 for tg
in ${targets[@]}; do
806 tmp_str
=$
(ssh root@
$tg "shopt -s nullglob; ${snap_list_cmds[*]}")
807 mapfile
-t tg_snaps
<<<"$tmp_str"
809 tmp
=$
(( ${#orphan_tg_snaps[*]} >= 1 ))
811 d
ssh root@
$tg "btrfs sub del ${orphan_tg_snaps[*]}"
816 # todo: umount first to ensure we don't have any errors
817 # todo: do some kill fuser stuff to make umount more reliable
827 m btrbk
-c /etc
/btrbk
$conf_suf.conf
-v -n $cmd_arg
830 # -q and just using the syslog option seemed nice,
831 # but it doesn't show when a send has a parent and when it doesn't.
832 m btrbk
-c /etc
/btrbk
$conf_suf.conf
$preserve_arg $verbose_arg $progress_arg $cmd_arg
838 # todo: tp not valid anymore.
839 # if we have it, sync to systems which don't
840 if mountpoint
$rsync_mountpoint >/dev
/null
; then
841 for tg
in ${targets[@]}; do
844 dirs=(/p
/c
/machine_specific
/tp
)
845 for x
in /p
/c
/machine_specific
/*.hosts
; do
846 if grep -qxF $tg $x; then
850 m rsync
-aSAXPH --specials --devices --delete --relative ${dirs[@]} root@
$tg:/
857 for mp
in "${mountpoints[@]}"; do
858 subvols
+=("${mp##*/}")
860 if [[ $source ]]; then
861 m mount-latest-subvol
"${subvols[@]}"
863 for tg
in ${targets[@]}; do
864 m
/a
/exe
/mount-latest-remote
"$tg" "${subvols[@]}" || ret
=$?
868 # todo, we get hostnames earlier, reuse that.
869 if [[ $ret == 0 ]]; then
870 for tg
in ${targets[@]}; do
871 h
=$
(ssh $tg hostname
)
872 if [[ $h == kd
&& $HOSTNAME == x3
&& $HOSTNAME == "$MAIL_HOST" ]]; then
873 m
ssh root@
$tg 'btrbk-spread-wrap &>/dev/null </dev/null &'
875 rsync
--mkpath -a -f"- */" -f"+ *" /var
/log
/btrbk
/ root@
$tg:/var
/log
/btrbk
/$tg
876 ssh root@
$tg /usr
/local
/bin
/mail-backup-clean
878 if [[ $source ]]; then
879 rsync
--mkpath -a -f"- */" -f"+ *" $source:/var
/log
/btrbk
/ /var
/log
/btrbk
/$source
885 # todo: move variable data we don't care about backing up
886 # to /nocow and symlink it.
889 # background on btrbk timezones. with short/long, timestamps use local time.
890 # for long, if your local time moves backwards, by moving timezones or
891 # for an hour when daylight savings changes it, you will temporarily get
892 # a more aggressive retention policy for the overlapping period, and
893 # vice versa for the opposite timezone move. The alternative is using
894 # long-iso, which puts timezone info into the timestamp, which means
895 # that instead of shifting time, you shift the start of day/week/month
896 # which is used for retention to your new local time, which means for
897 # example, if you moved forward by 8 hours, the daily/weekly/monthly
898 # retention will be 8 hours more aggressive since midnight is at a new
899 # time, unless you fake the timzeone using the TZ env variable.
900 # However, in the short term, there will be no inconsistencies.
901 # I don't see any problem with shifting when the day starts for
902 # retention, so I'm using long-iso.
904 # note to create a long-iso timestamp: date +%Y%m%dT%H%M%S%z