various fixes
authorIan Kelling <ian@iankelling.org>
Thu, 26 Nov 2020 20:27:39 +0000 (15:27 -0500)
committerIan Kelling <ian@iankelling.org>
Thu, 26 Nov 2020 20:27:39 +0000 (15:27 -0500)
bk-backup
brc
brc2
mail-setup
mailtest-check

index a71e77f0025d242b950e384e37746ca808160c32..67759fa9d3ed6d2ff2444a7343a53e0996239fcf 100755 (executable)
--- a/bk-backup
+++ b/bk-backup
@@ -24,8 +24,11 @@ if $restore; then
   for ncdir in /var/www/ncexpertpath /var/www/ncninja; do
     ssh root@$host sudo -u www-data php $ncdir/occ -q maintenance:mode --on ||: # might not be running
     rsync -ra /p/bkbackup/$ncbase/ root@$host:$ncdir  || ret=$?
+    # https://docs.nextcloud.com/server/20/admin_manual/configuration_server/occ_command.html#maintenance-commands-label
+    ssh root@$host sudo -u www-data php $ncdir/occ -q maintenance:data-fingerprint
+    ssh root@$host sudo -u www-data php $ncdir/occ -q maintenance:mode --on
   done
-  rsync -ravi /p/bkbackup/rc/ root@$host:/m/rc
+  rsync -ravi /p/bkbackup/m root@$host:/
   exit 0
 fi
 
@@ -43,6 +46,6 @@ if [[ $HOSTNAME == $MAIL_HOST ]]; then
        ret=1
     fi
   done
-  rsync -rai --delete root@$host:/m/rc /p/bkbackup
+  rsync -rai --delete root@$host:/m /p/bkbackup
 fi
 exit $ret
diff --git a/brc b/brc
index fcc17eb4d691b137eabb225d364affc01737cc07..b2eac3f3100dbe27098559c9545ccf08e9af0d93 100644 (file)
--- a/brc
+++ b/brc
@@ -1154,7 +1154,7 @@ resolvcat() {
   fi
   hr
   echo /etc/nsswitch.conf:
-  grep '^ *files' /etc/nsswitch.conf
+  grep '^ *hosts:' /etc/nsswitch.conf
   if systemctl is-enabled systemd-resolved &>/dev/null || [[ $(systemctl is-active systemd-resolved ||:) != inactive ]]; then
     hr; m ser status systemd-resolved | cat || :
     hr; m systemd-resolve --status | cat
diff --git a/brc2 b/brc2
index 744a92c365e75ae5a2606f8fdcc878a17749b0a2..d505e90d20ea8f9debd14441d4fcc52ff023ab02 100644 (file)
--- a/brc2
+++ b/brc2
@@ -1111,13 +1111,6 @@ r2eadd() { # usage: name url
 }
 r2e() { command r2e -d /p/c/rss2email.json -c /p/c/rss2email.cfg "$@"; }
 
-if type -P rg &>/dev/null; then
-  rg() { command rg -i -M 200 "$@"; }
-  complete -r rg
-else
-  alias rg=grr
-fi
-
 rspicy() { # usage: HOST DOMAIN
   # connect to spice vm remote host. use vspicy for local host
   local port
@@ -1494,6 +1487,15 @@ path-add --end ~/.npm-global
 
 path-add --end $HOME/.cargo/bin
 
+if type -P rg &>/dev/null; then
+  rg() { command rg -i -M 200 "$@"; }
+  complete -r rg
+else
+  alias rg=grr
+fi
+
+
+
 # taken from default changes to bashrc and bash_profile
 path-add --end --ifexists $HOME/.rvm/bin
 # also had ruby bin dir, but moved that to environment.sh
index 4e277efa03494e2e27c6c5fadd1d040bcd264ad3..8ae33ba3ff0a9f1f052ef9b49c8ff7fb3cde0df1 100755 (executable)
@@ -1,11 +1,21 @@
 #!/bin/bash
-
-# todo: figure out
-
 # * intro
 # Copyright (C) 2019 Ian Kelling
 # SPDX-License-Identifier: AGPL-3.0-or-later
 
+# todo: notification of updates for nextcloud.
+# this should do it:
+# if ! timeout 10 sudo -u www-data php /var/www/ncninja/updater/updater.phar
+
+# todo setup better backup/sync of MAIL_HOST emails
+
+# todo: reinstall bk with bigger filesystem
+
+# fix so i dont have to do this every reboot:
+# /a/f/ans A D PANIC! $ s mkdir /var/run/clamav
+#
+#/a/f/ans A D PANIC! $ s chown clamav /var/run/clamav
+
 # todo: monitor for msft unblock, and then remove on bk:
 # /etc/exim4/conf.d/router/190_msft
 # dnslookup_msft
@@ -40,8 +50,8 @@
 # in 2 or 3 days or something. todo, test cron mail on li.
 
 # todo: look at mailinabox extra dns records, note these changelogs:
-# * An MTA-STS policy for incoming mail is now published (in DNS and over HTTPS) when the primary hostname and email address domain both have a signed TLS certificate installed, allowing senders to know that an encrypted connection should be enforced.
-# * The per-IP connection limit to the IMAP server has been doubled to allow more devices to connect at once, especially with multiple users behind a NAT.
+# - An MTA-STS policy for incoming mail is now published (in DNS and over HTTPS) when the primary hostname and email address domain both have a signed TLS certificate installed, allowing senders to know that an encrypted connection should be enforced.
+# - The per-IP connection limit to the IMAP server has been doubled to allow more devices to connect at once, especially with multiple users behind a NAT.
 #
 
 # todo: mailtest-check failure on remote hosts is not going to alert me.
@@ -1553,7 +1563,9 @@ EOF
     m mkdir -p $rclogdir
     m chmod 750 $rclogdir
     m chown www-data:adm $rclogdir
-    # todo rss subscribe to carddav plugin
+    # note: subscribed to updates:
+    # r2e add rcmcarddav https://github.com/blind-coder/rcmcarddav/commits/master.atom ian@iankelling.org
+    # r2e add roundcube https://github.com/roundcube/roundcubemail/releases.atom ian@iankelling.org
     m mkdir -p $rctmpdir /m/rc
     m chown -R www-data.www-data $rctmpdir /m/rc
     m chmod 750 $rctmpdir
@@ -2306,7 +2318,6 @@ EOF
     echo '#!/bin/bash' >/usr/local/bin/send-test-forward
     for test_from in ${test_froms[@]}; do
       cat >>/usr/local/bin/send-test-forward <<EOFOUTER
-#!/bin/bash
 /usr/sbin/exim -f $test_from -t <<EOF
 From: $test_from
 To: $test_to
index 1adec42d2953769a3474e43c103f158d8eb443cc..5d5822144d7f7aaf600500c950f4a971a4efb76a 100755 (executable)
@@ -67,12 +67,12 @@ for folder in ${folders[@]}; do
 
       if $slow; then
         find $folder/new $folder/cur -type f -mmin +300 -delete
-        if [[ ! $spamdpid ]]; then
-          spamdpid=$(systemctl status spamassassin| sed -n '/^ *Main PID:/s/[^0-9]//gp')
+        if [[ ! $nspid ]]; then
+          nspid=$(systemctl status mailnn| sed -n '/^ *Main PID:/s/[^0-9]//gp')
         fi
-        if [[ $spamdpid ]]; then
-          if [[ $(readlink /proc/$$/ns/net) != "$(readlink /proc/$spamdpid/ns/net)" ]]; then
-            spamcpre="nsenter -t $spamdpid -n -m"
+        if [[ $nspid ]]; then
+          if [[ $(readlink /proc/$$/ns/net) != "$(readlink /proc/$nspid/ns/net)" ]]; then
+            spamcpre="nsenter -t $nspid -n -m"
           fi
 
           declare -A results
@@ -118,7 +118,9 @@ for folder in ${folders[@]}; do
               printf "missing %s" "${missing[*]}"
             fi
             echo
+            echo mailtest-check: cat $folder/$latest:
             cat $folder/$latest
+            echo mailtest-check: end of cat
           fi
         else
           echo $HOSTNAME mailtest spamd pid not found