_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
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
}
sudo dd of=/etc/systemd/system/keyscriptoff.service <<'EOF'
[Unit]
-Description=keyscriptoff
+Description=keyscriptoffIMG_20200803_221621
[Service]
Type=oneshot
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
# /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
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
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
}
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
}
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}
--- /dev/null
+#!/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
loop-file=no
shuffle
#volume=50
-save-position-on-quit
+#save-position-on-quit
# use --profile d
[d]