various fixes
authorIan Kelling <ian@iankelling.org>
Fri, 13 Nov 2020 04:00:33 +0000 (23:00 -0500)
committerIan Kelling <ian@iankelling.org>
Fri, 13 Nov 2020 04:00:33 +0000 (23:00 -0500)
btrbk-run
conflink
mail-setup
mailtest-check

index c2b9e806e57aafa41b1c23e7b856fb749c893730..499ec883ecacaaa5c0e134c3a8336a9867227b9a 100644 (file)
--- a/btrbk-run
+++ b/btrbk-run
@@ -76,9 +76,10 @@ if [[ -s $default_args_file ]]; then
   sleep 5
 fi
 
+early=false # quit early, just btrbk, no extra remounting etc.
 cron=false
 orig_args=("$@")
-temp=$(getopt -l cron,pull-reexec,help cil:m:npqs:t:vh "$@") || usage 1
+temp=$(getopt -l cron,pull-reexec,help ceil:m:npqs:t:vh "$@") || usage 1
 eval set -- "$temp"
 while true; do
   case $1 in
@@ -89,6 +90,7 @@ while true; do
       ;;
     # only creates the config file, does not run btrbk
     -c) conf_only=true; shift ;;
+    -e) early=true; shift ;;
     -i) incremental_strict=true; shift ;;
     # bytes per second, suffix k m g
     -l) rate_limit=$2; shift 2 ;;
@@ -130,6 +132,8 @@ if (( $# > 1 )); then
 fi
 
 if [[ -v targets && $source ]]; then
+  # note, this doesnt need to be the case, but
+  # we would need to think about it.
   die "error: -t and -s are mutually exclusive"
 fi
 
@@ -147,11 +151,15 @@ fi
 # TODO: i wonder if there should be an option to send to the default
 # targets, plus any given on the command line.
 
+
+amy=false
 # set default targets
 if [[ ! -v targets && ! $source ]]; then
   if [[ $HOSTNAME != "$MAIL_HOST" ]] && $cron ; then
     echo "MAIL_HOST=$MAIL_HOST, nothing to do"
     mexit 0
+  else
+    amy=true
   fi
 
   at_work=false
@@ -397,7 +405,8 @@ volume ssh://$bbksource$vol
 subvolume $sub
 target send-receive $vol/btrbk
 EOF
-  else
+  fi
+  if (( ${#target[@]} )); then
     cat >>/etc/btrbk.conf <<EOF
 volume $vol
 subvolume $sub
@@ -414,6 +423,15 @@ EOF
   fi
 done
 
+# if $amy; then
+#   # to manually backup amy,
+#   # bbk -e -s amy -m root_ubuntubionic
+#   cat >>/etc/btrbk.conf <<'EOF'
+# volume ssh://amy/mnt/root
+# subvolume root_ubuntubionic
+# target send-receive /mnt/root/btrbk
+# EOF
+# fi
 
 # todo: umount first to ensure we don't have any errors
 # todo: do some kill fuser stuff to make umount more reliable
@@ -442,6 +460,7 @@ fi
 # but it doesn't show when a send has a parent and when it doesn't.
 m btrbk $verbose_arg $progress_arg $cmd_arg
 
+# todo: tp not valid anymore.
 # if we have it, sync to systems which don't
 if mountpoint $rsync_mountpoint >/dev/null; then
   for tg in ${targets[@]}; do
index b70e26f17689f10245ea4e27234a29c1c00657d0..60d0372d896727ca472ada50f0f81586ac4ca7c2 100755 (executable)
--- a/conflink
+++ b/conflink
@@ -128,7 +128,6 @@ common-file-setup() {
 
 }
 
-install-my-scripts
 user=$(id -un)
 all_dirs=({/a/bin/ds,/p/c}{,/machine_specific/$HOSTNAME})
 # note, we assume a group of hosts does not have the
@@ -140,6 +139,7 @@ done
 c_dirs=(/a/c{,/machine_specific/$HOSTNAME})
 case $user in
   iank)
+    /a/bin/ds/install-my-scripts
     files=(/p/c/machine_specific/*/filesystem/etc/ssh/*_key
            /p/c/filesystem/etc/openvpn/client/*.key
            /p/c/filesystem/etc/openvpn/easy-rsa/keys/*.key
index de8638f8236e4942db01d6ac5be5e9863946a4e0..3bfc8b29a3fd3886584d60fd2b8060f2c75c5307 100755 (executable)
@@ -2226,8 +2226,11 @@ PATH=/usr/bin:/bin:/usr/local/bin
 MAILTO=alerts@iankelling.org
 */5 * * * *   $u send-test-forward |& log-once send-test-forward
 */10 * * * *   root chmod -R g+rw /m/md/bounces |& log-once -1 bounces-chmod
-5-59/5 * * * *   root mailtest-check |& log-once -1 mailtest-check
-0 * * * *   root mailtest-check slow |& log-once -1 mailtest-slow
+# im seeing some intermittent failures on the slow check, do it all the time
+# for now. It looks like a dns failure.
+#5-59/5 * * * *   root mailtest-check |& log-once -1 mailtest-check
+#0 * * * *   root mailtest-check slow |& log-once -1 mailtest-slow
+*/5 * * * *   root mailtest-check slow |& log-once -1 mailtest-check
 EOF
     m sudo rsync -ahhi --chown=root:root --chmod=0755 \
       /b/ds/mailtest-check /b/ds/check-remote-mailqs /usr/local/bin/
index 9e35a0ac45ac3e8f5ebe4b76d1b84663da038dc6..e8f146d274e30736432aee0646d36479fe3a6cbf 100755 (executable)
@@ -110,12 +110,12 @@ for folder in ${folders[@]}; do
             fi
           done
           if (( ${#results[@]} || ${#missing[@]} )); then
-            printf "$HOSTNAME spamtest %s %s" "$folder" "$from"
+            printf "$HOSTNAME spamtest %s %s/%s\n" "$folder" "$latest"
             if (( ${#results[@]} )); then
-              printf " unexpected %s" "${!results[*]}"
+              printf "unexpected %s" "${!results[*]} "
             fi
             if (( ${#missing[@]} )); then
-              printf " missing %s" "${missing[*]}"
+              printf "missing %s" "${missing[*]}"
             fi
             echo
           fi