various fixes and improvements
authorIan Kelling <ian@iankelling.org>
Sun, 16 Aug 2020 14:01:12 +0000 (10:01 -0400)
committerIan Kelling <ian@iankelling.org>
Sun, 16 Aug 2020 14:01:12 +0000 (10:01 -0400)
brc
distro-begin
distro-end
i3-sway/i3.conf
mail-route
mailclean
pt [new file with mode: 0755]
subdir_files/.config/mpv/mpv.conf

diff --git a/brc b/brc
index c2cac5b224b3a6121d7aa33b4dc7344f2d769f09..46651f1317d0444952149a3ace660c84fa3386fc 100644 (file)
--- a/brc
+++ b/brc
@@ -252,7 +252,7 @@ fpst() { # file paste
 _khfix_common() {
   local host=${1##*@}
   local ip port
-  read -r ip port < <(timeout 1 ssh -oBatchMode=yes -oControlMaster=no -oControlPath=/ -v $1 |& sed -rn "s/debug1: Connecting to $host \[([^\]*)] port ([0-9]+).*/\1 \2/p")
+  read -r ip port < <(timeout 1 ssh -oBatchMode=yes -oControlMaster=no -oControlPath=/ -v $1 |& sed -rn "s/debug1: Connecting to $host \[([^\]*)] port ([0-9]+).*/\1 \2/p" || [[ $? == 124 ]])
   if [[ ! $ip ]]; then
     echo "khfix: ssh failed"
     return 1
@@ -520,6 +520,60 @@ ediff() {
 etail() {
   tail -F /var/log/exim4/mainlog -n 200 "$@"
 }
+
+# print exim old pids
+eoldpids() {
+  local configtime pid piduptime now daemonpid
+  printf -v now '%(%s)T' -1
+  configtime=$(stat -c%Y /var/lib/exim4/config.autogenerated)
+  if [[ -s /run/exim4/exim.pid ]]; then
+    daemonpid=$(cat /run/exim4/exim.pid)
+  fi
+  for pid in $(pgrep -f '^/usr/sbin/exim4( |$)'); do
+    # the daemonpid gets reexeced on HUP (service reloads), keeping its same old timestamp
+    if [[ $pid == $daemonpid ]]; then
+      continue
+    fi
+    piduptime=$(awk -v ticks="$(getconf CLK_TCK)" 'NR==1 { now=$1; next } END { printf "%9.0f\n", now - ($20/ticks) }' /proc/uptime RS=')' /proc/$pid/stat) ||: # sometimes pids disappear pretty fast
+    if (( configtime > now - piduptime )); then
+      echo $pid
+    fi
+  done
+}
+
+# exim tail but only watch lines from new pids
+etailnew() {
+  local pid oldpids
+  for pid in $(eoldpids); do
+    oldpids+="$pid|"
+  done
+  if [[ $oldpids ]]; then
+    etail | awk '$3 !~ /^\[('"${oldpids%|}"')\]$/'
+  else
+    etail
+  fi
+}
+# exim watch as old pids go away
+ewatchold() {
+  local configtime pid piduptime now
+  local -i count
+  local -a oldpids
+  count=0
+  while true; do
+    oldpids=($(eoldpids))
+    if (( ! ${#oldpids[@]} )); then
+      return
+    fi
+    # print the date every 20 iterations
+    if (( ! count % 20 )); then
+      date
+    fi
+    count+=1
+    ps -f -p "${oldpids[*]}"
+    sleep 1
+  done
+}
+
 eless() {
   less /var/log/exim4/mainlog
 }
index 619cc25f98c8895bd19e609654321138791a9a31..8595d1bfafc248c82d2e7bc1b9ae0709f7e50cc6 100755 (executable)
@@ -153,7 +153,7 @@ EOF
 
   sudo dd of=/etc/systemd/system/keyscriptoff.service <<'EOF'
 [Unit]
-Description=keyscriptoff
+Description=keyscriptoffIMG_20200803_221621
 
 [Service]
 Type=oneshot
index cc593e25a69e131f46410ff9c8d901251ca5de17..b99c242b001c32c6e19fcf233f9eac15bc0d3ba9 100755 (executable)
@@ -523,9 +523,9 @@ ifconfig-ipv6-push 2600:3c00:e000:280::2/64
 EOF
 
     if [[ -e /lib/systemd/system/openvpn-server@.service ]]; then
-      vpn_service=openvpn-server@server
+      vpn_service=openvpn-server@mail
     else
-      vpn_service=openvpn@server
+      vpn_service=openvpn@mail
     fi
 
     sudo dd of=/etc/systemd/system/vpnmail.service <<EOF
@@ -1013,6 +1013,8 @@ s DEBIAN_FRONTEND=noninteractive pi wireshark-gtk
 # /run/usr/1000 i noticed was missing for pulseaudio
 # /run/user/0 just seemed like a not bad idea, given the above
 tu /etc/schroot/desktop/fstab <<'EOF'
+/p             /p              none    rw,bind         0       0
+/a             /a              none    rw,bind         0       0
 /run           /run            none    rw,bind         0       0
 /run/lock      /run/lock       none    rw,bind         0       0
 /dev/shm       /dev/shm        none    rw,bind         0       0
@@ -1541,10 +1543,6 @@ EOF
 m pu transmission-gtk
 
 
-# pithosfly broken
-#m /a/bin/buildscripts/pithosfly
-
-
 # # Based on guix manual instructions, also added code to profile.
 # # disabled since i'm not using it now.
 # pi nscd
index 29fb0a8bf388d6ff8ad25d5b0597acc9df23057f..6d64b8f626c3c15bfb59174688e3ca0131c38a86 100644 (file)
@@ -5,7 +5,7 @@ bindsym $mod+Shift+p restart
 
 bar {
 #status_command i3status
-status_command          /usr/local/bin/myi3status
+#status_command          /usr/local/bin/myi3status
 mode hide
 hidden_state hide
 font pango:monospace 14
index 600ef076d7465a033bd6cc4f60245433b1502380..2aecfaad6d0f044b68cbcc83a3b7e104841bcf57 100755 (executable)
@@ -89,8 +89,6 @@ down() {
 }
 
 show() {
-  printf "$(tput setaf 5)█$(tput sgr0)%.0s" $(seq ${COLUMNS:-60});
-  echo
   e() { printf "=================================\n# %s\n\n" "$*"; "$@"; }
   e iptables -t mangle -S
   e ip6tables -t mangle -S
index 8755338bb62a93d2f0ac9bcc52acb22e6398272e..c4cd2c56558d12bc19d94da73ab0670c1425cb5e 100755 (executable)
--- a/mailclean
+++ b/mailclean
@@ -61,6 +61,6 @@ archive() {
 }
 
 cd /m/md
-archive 400 ./!(*archive|Drafts)/*(cur|new) ./l/!(*archive)/*(cur|new)
+archive 400 ./!(*archive|Drafts|Sent|INBOX)/*(cur|new) ./l/!(*archive)/*(cur|new)
 archive 60 ./{sysadmin,rtcc,fsfcc,fsfmembers}/{cur,new}
 archive 14 ./Junk/{cur,new}
diff --git a/pt b/pt
new file mode 100755 (executable)
index 0000000..5e8ff9a
--- /dev/null
+++ b/pt
@@ -0,0 +1,12 @@
+#!/bin/bash
+# Copyright (C) 2019 Ian Kelling
+# SPDX-License-Identifier: Apache-2.0
+
+if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
+
+shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?. PIPESTATUS: ${PIPESTATUS[*]}" >&2' ERR
+
+cd /a/opt/Pithosfly
+ninja -C build run
index b7c2860d4f90f80f01f047446cb73affde3d9a01..83251537d2cd9274ec45ed16ece924f21fe74d73 100644 (file)
@@ -5,7 +5,7 @@
 loop-file=no
 shuffle
 #volume=50
-save-position-on-quit
+#save-position-on-quit
 
 # use --profile d
 [d]