X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=btrbk-run;h=a1c6963a926b445454ca1d27634a56737e2d34da;hb=866a0cbd9127386520def96ff49bdc8424df8112;hp=d05616a8861f14c914ce491a7f74460687c060eb;hpb=d46190aff6f5dc65bd39524e3937dc5765895b42;p=distro-setup diff --git a/btrbk-run b/btrbk-run index d05616a..a1c6963 100755 --- a/btrbk-run +++ b/btrbk-run @@ -13,6 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. + +# todo: remove old leaf subvols, like keep up to 1 month or something. + set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR @@ -78,12 +81,12 @@ echo -e "$0: options: conf_only=$conf_only\ndry_run=$dry_run\nresume_arg=$resume # set default targets if [[ ! -v targets ]]; then case $HOSTNAME in - x2) + x2|kw) if [[ $HOSTNAME == "$MAIL_HOST" ]]; then targets=($HOME_DOMAIN) fi ;; - treetowl) + tp) targets=(frodo) if [[ $HOSTNAME == "$MAIL_HOST" ]]; then if timeout -s 9 10 ssh x2 :; then @@ -113,14 +116,23 @@ if (( ${#mountpoints[@]} )); then fi done else # set default mountpoints - if [[ $HOSTNAME == frodo ]]; then - prospective_mps=(/i) - else - prospective_mps=(/a /q) - if [[ $HOSTNAME == "$MAIL_HOST" ]]; then - prospective_mps+=(/o) - fi - fi + case $HOSTNAME in + frodo) + prospective_mps=(/i) + ;; + *) + prospective_mps=(/a /q) + if [[ $HOSTNAME == "$MAIL_HOST" ]]; then + prospective_mps+=(/o) + fi + ;; + esac + case ${targets[0]} in + kw|kww) + prospective_mps=(/a) + ;; + esac + for mp in ${prospective_mps[@]}; do # default mountpoints to sync if [[ -e /nocow/btrfs-stale/$mp ]]; then echo "$0: warning: $mp stale, not adding to default mountpoints" @@ -165,7 +177,7 @@ if ! which btrbk &>/dev/null; then fi cat >/etc/btrbk.conf <