X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=blobdiff_plain;f=brc2;h=cdac34b690b40401c314c0138a543e7918674d09;hp=d9c7cbde71d5da4126b1466c106e699e9375d02b;hb=77917a8fbf2032a8b2634a1b3de0879ec45cf213;hpb=ef571de225d48762aad38f9a5a3b28bbab654e39 diff --git a/brc2 b/brc2 index d9c7cbd..cdac34b 100644 --- a/brc2 +++ b/brc2 @@ -114,11 +114,11 @@ bbk() { # btrbk wrapper local active=true systemctl is-active btrbk.timer || active=false if $active; then - ser disable btrbk.timer + ser stop btrbk.timer fi - if systemctl is-active btrbk.service; then - $active && ser enable btrbk.timer + if [[ $(systemctl is-active btrbk.service ||:) != inactive ]]; then echo "cron btrbk is already running" + if $active; then ser start btrbk.timer; fi return 1 fi # run latest @@ -126,9 +126,9 @@ bbk() { # btrbk wrapper jrun -p btrbk btrbk-run "$@" if $active; then if (( $ret )); then - echo bbk: WARNING: btrbk.timer not reenabled due to failure + echo bbk: WARNING: btrbk.timer not restarted due to failure else - ser enable btrbk.timer + ser start btrbk.timer fi fi return $ret @@ -807,22 +807,28 @@ resolvcat() { m s nscd -i hosts f=/etc/resolv.conf echo $f:; ccat $f - # this will fail is dnsmasq is failed - hr; m ser status dnsmasq | cat || : hr; s ss -lpn 'sport = 53' - #hr; echo dnsmasq is $(systemctl is-active dnsmasq) - f=/var/run/dnsmasq/resolv.conf - hr; echo $f:; ccat $f - hr; m grr '^ *(servers-file|server) *=|^ *no-resolv *$' /etc/dnsmasq.conf /etc/dnsmasq.d - f=/etc/dnsmasq-servers.conf - hr; echo $f:; ccat $f + if systemctl is-enabled dnsmasq &>/dev/null || [[ $(systemctl is-active dnsmasq ||:) != inactive ]]; then + # this will fail is dnsmasq is failed + hr; m ser status dnsmasq | cat || : + f=/var/run/dnsmasq/resolv.conf + hr; echo $f:; ccat $f + hr; m grr '^ *(servers-file|server) *=|^ *no-resolv *$' /etc/dnsmasq.conf /etc/dnsmasq.d + f=/etc/dnsmasq-servers.conf + hr; echo $f:; ccat $f + fi + 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 + fi + } rcat() { resolvcat | less } reresolv() { sudo nscd -i hosts - sudo systemctl restart dnsmasq + #sudo systemctl restart dnsmasq } # only run on MAIL_HOST. simpler to keep this on one system.