cmd=$(which $1)
fi
journalctl -qn2 -f -u "$cmd_name" &
+ # 1st guess to avoid missing some initial lines.
+ sleep .5
# We kill this in prompt-command for the case that we ctrl-c the
# systemd-cat. i dont know any way to trap ctrl-c and still run the
# normal action for it. There might be a way, unsure.
/a/opt/idea-IC-163.7743.44/bin/idea.sh "$@" &r
}
+ilogs() {
+ ssh root@iankelling.org "cd /var/lib/znc/moddata/log/iank/freenode/ && hr && for x in \#$1/*; do base=\${x##*/}; files=(); for f in $@; do tmp=\#\$f/\$base; if [[ -e \$tmp ]]; then files+=(\#\$f/\$base); fi; done; sed \"s/^./\${base%log}/\" \${files[@]}|sort -n; hr; done"
+}
+
ilog() {
chan=${1:-#fsfsys}
# use * instead of -r since that does sorted order
m sudo nsenter -t $(pgrep -f "/usr/sbin/exim4 -bd -q30m -C /etc/exim4/my.conf"|h1) -n -m sudo -u $USER -i bash
}
+mailnncheck() {
+ local pid ns mailnn
+ for p in mailnn mailvpn unbound dovecot spamassassin exim4 radicale; do
+ pid=$(s systemctl status $p| sed -n '/^ *Main PID:/s/[^0-9]//gp')
+ if [[ ! $pid ]]; then
+ echo failed to find pid for $p
+ continue
+ fi
+ if ! ns=$(s readlink /proc/$pid/ns/net); then
+ echo failed to find ns for $p pid=$pid
+ continue
+ fi
+ if [[ $mailnn ]]; then
+ if [[ $ns != "$mailnn" ]]; then
+ echo "$p ns $ns != $mailnn"
+ fi
+ else
+ mailnn=$ns
+ fi
+ done
+
+}
+
vpncmd() {
m sudo --preserve-env=PATH -E nsenter -t $(pgrep -f "/usr/sbin/openvpn .* --config /etc/openvpn/.*client.conf") -n -m "$@"
cat > /home/iank/.xscreensaver <<'EOF'
mode: blank
dpmsEnabled: True
-dpmsStandby: 0:02:00
-dpmsSuspend: 0:03:00
+dpmsStandby: 0:07:00
+dpmsSuspend: 0:08:00
dpmsOff: 0:00:00
-timeout: 0:02:00
+timeout: 0:05:00
lock: True
-lockTimeout: 0:03:00
+lockTimeout: 0:06:00
splash: False
EOF
done
if ! $pull_reexec && [[ $source ]] && $pulla ; then
tmpf=$(mktemp)
- scp $source:/a/bin/distro-setup/btrbk-run $tmpf
+ m rsync -ra $source:/usr/local/bin/{mount-latest-subvol,check-subvol-stale} /usr/local/bin
+ m rsync -ra $source:/usr/local/lib/err /usr/local/lib
+ m scp $source:/a/bin/distro-setup/btrbk-run $tmpf
if ! diff -q $tmpf ${BASH_SOURCE[0]}; then
e "found newer version on host $source. reexecing"
install -T $tmpf /usr/local/bin/btrbk-run
fi
# http://strugglers.net/~andy/blog/2020/12/03/starting-services-only-when-the-network-is-ready-on-debiansystemd/
-systemctl enable ifupdown-wait-online.service
+if systemctl cat ifupdown-wait-online.service &>/dev/null; then
+ sudo systemctl enable ifupdown-wait-online.service
+fi
if bitfolk; then
# remove line like this: 85.119.82.128 je.iankelling.org je
;;
li)
-
-
m /a/h/setup.sh iankelling.org
# start mumble only when im going to use it, since i dont use it much
# general vpn for as needed use
vpn-server-setup -d -r -4 10.2.2 -p 443 -n hole
+ sd /etc/openvpn/client-config-hole/kw <<'EOF'
+ifconfig-push 10.2.2.9 255.255.255.0
+EOF
+ sd /etc/openvpn/client-config-hole/x3 <<'EOF'
+ifconfig-push 10.2.2.8 255.255.255.0
+EOF
+ sd /etc/openvpn/client-config-hole/x2 <<'EOF'
+ifconfig-push 10.2.2.7 255.255.255.0
+EOF
+ sd /etc/openvpn/client-config-hole/wclient <<'EOF'
+ifconfig-push 10.2.2.6 255.255.255.0
+EOF
sd /etc/openvpn/client-config-hole/frodo <<'EOF'
ifconfig-push 10.2.2.5 255.255.255.0
EOF
pi ${pall[@]} $(apt-cache search ruby[.0-9]+-doc| awk '{print $1}') $($src/distro-pkgs)
-seru enable psd
-seru start psd
+# commented, not worth the hassle i think.
+#seru enable psd
+#seru start psd
# website is dead june 14 2019. back in october, but meh
/p/c/gen-fsf-vpn
fi
+if [[ -e /p/c/machine_specific/$HOSTNAME/etc/openvpn/client/hole.crt ]]; then
+ sgo openvpn-client@hole
+ fi
+
if [[ $HOSTNAME == frodo ]]; then
vpn-mk-client-cert -b frodo -n hole iankelling.org
fi
s cedit hole /etc/hosts <<EOF ||:
10.2.2.3 amy amy.b8.nz
10.2.2.5 frodo frodo.b8.nz
+10.2.2.6 wclient wclient.b8.nz
EOF
fi
;;
esac
-
-spamdpid=$(systemctl status spamassassin| sed -n '/^ *Main PID:/s/[^0-9]//gp')
+getspamdpid() {
+ if [[ ! $spamdpid || ! -d /proc/$spamdpid ]]; then
+ spamdpid=$(systemctl status spamassassin| sed -n '/^ *Main PID:/s/[^0-9]//gp')
+ fi
+}
+getspamdpid
e spamdpid: $spamdpid
if [[ ! $spamdpid ]]; then
echo $HOSTNAME mailtest spamd pid not found
if $slow; then
find $folder/new $folder/cur -type f -mmin +1080 -delete
+ getspamdpid
if [[ $spamdpid ]]; then
if [[ $(readlink /proc/$$/ns/net) != "$(readlink /proc/$spamdpid/ns/net)" ]]; then
spamcpre="nsenter -t $spamdpid -n -m"
pidgin
pidgin-otr
pixz
- profile-sync-daemon
pry
pv
python-autopep8
#DISPLAY=:0 arbtt-capture --sample-rate=10 &
m sudo systemctl start rss2email.timer
m sudo systemctl enable rss2email.timer
+ # off is in mail-setup. no reason for this to be in the rss2email block.
m sudo systemctl start btrbk.timer
m sudo systemctl enable btrbk.timer
fi
fi
+# todo: whats going on here? figure out if this should be removed.
+
# if dpkg -s radicale &>/dev/null; then
# if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
# m sudo systemctl restart radicale
# fi
# fi
+
+# todo: this needs to be disabled earlier than primary-setup in switch-mail-host
+
+# if dpkg -s profile-sync-daemon &>/dev/null; then
+# if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
+# m systemctl --user start psd
+# m systemctl --user enable psd
+# else
+# m systemctl --user stop psd
+# m systemctl --user disable psd
+# fi
+# fi
+
+
if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
- m sudo systemctl --user start psd
- m sudo systemctl --user enable psd
m sudo systemctl start openvpn-client@hole
m sudo systemctl enable openvpn-client@hole
else
- m sudo systemctl --user stop psd
- m sudo systemctl --user disable psd
m sudo systemctl stop openvpn-client@hole
m sudo systemctl disable openvpn-client@hole
fi
chmod 700 $d/root $d/root/.ssh
cp -p /root/.ssh/authorized_keys $d/root/.ssh/authorized_keys
cp -p /root/.ssh/authorized_keys /etc/dropbear-initramfs
+ if [[ -e /root/.ssh/authorized_keys2 ]]; then
+ cat /root/.ssh/authorized_keys2 >>/etc/dropbear-initramfs
+ fi
update-initramfs -u -k all
fi