mostly fixes
[distro-setup] / brc2
diff --git a/brc2 b/brc2
index bad1194baf610135693989e4eb8da56efee403de..93581a70bbadf2b7204c97eff07ad39925d741d4 100644 (file)
--- a/brc2
+++ b/brc2
@@ -1189,7 +1189,7 @@ beet2nav() {
 
 # pull in beets library locally
 beetpull() {
-  local sshfs_host
+  local sshfs_host sshfs_cmd
   sshfs_host=b8.nz
   if [[ $HOSTNAME == kd ]]; then
     return 0
@@ -1198,8 +1198,9 @@ beetpull() {
     s mkdir /i
     s chown iank:iank /i
   fi
-  if ! mountpoint /i &>/dev/null; then
-    m sshfs $sshfs_host:/i /i
+  sshfs_cmd="sshfs -o ServerAliveInterval=15,reconnect $sshfs_host:/i /i"
+  if ! pgrep -f "^$sshfs_cmd$" >/dev/null; then
+    m $sshfs_cmd
   fi
 }
 
@@ -2817,7 +2818,12 @@ myprof() {
   else
     i=0
   fi
-  min_date=$(date -d 'monday 2 weeks ago' +%s)
+  # usually do this on monday, sometimes later
+  if [[ $(date +%A) == Monday ]]; then
+    min_date=$(date -d 'monday 2 weeks ago' +%s)
+  else
+    min_date=$(date -d 'monday 3 weeks ago' +%s)
+  fi
   for (( ; i < logcount; i++ )); do
     log=${logs[$i]}
     d=$(date -d "$(head -n1 $log|awk '{print $1}')" +%s)
@@ -2831,12 +2837,24 @@ myprof() {
   popd
 }
 
-# tail pms in the last day, for the case where we restart profanity and
-# didn't check for pms beforehand.
-profrecent() {
+# Tail pms in the last day, for the case where we restart profanity and
+# didn't check for pms beforehand. Assume the most recent logs are on kd.
+# If that isn't the case, use prof-recent-local
+prof-recent() {
+  case $HOSTNAME in
+    kd)
+      prof-recent-local
+      ;;
+    *)
+      ssh b8.nz prof-recent-local
+      ;;
+  esac
+}
+
+prof-recent-local() {
   local d dates date files f
   # consider making the day count passed by parameter. note: this works: $(date -d '2 day ago' +%Y_%m_%d)
-  dates=("$(date -d +%Y_%m_%d)" "$(date -d '1 day ago' +%Y_%m_%d)" )
+  dates=("$(date +%Y_%m_%d)" "$(date -d '1 day ago' +%Y_%m_%d)" )
   for d in /d/p/profanity/chatlogs/iank_at_fsf.org/!(rooms); do
     files=()
     for date in ${dates[@]}; do