faster retries to avoid alerts
[distro-setup] / distro-end
index 878a6ab3b6ee1d7fa26faf173fc02e597d80082d..6e86d21a8487225e12b2cf82f0cdab43271cf56b 100755 (executable)
@@ -842,7 +842,7 @@ EOF
     # also would be nice if erc supported
     # https://wiki.znc.in/self-message
     # https://wiki.znc.in/Query_buffers                                                \
-    #
+      #
     # for geekshed, there was no sasl support as far as I can tell,
     # so I set to msg nickserv to identify upon connect.
     if ! getent passwd znc > /dev/null; then
@@ -1552,7 +1552,8 @@ sudo chown -R debian-transmission:debian-transmission /var/lib/transmission-daem
 # It is a read & write cache.
 if ! systemctl is-active transmission-daemon-nn &>/dev/null && \
     ! systemctl is-active transmission-daemon; then
-  sudo ruby <<EOF | sponge /etc/transmission-daemon/settings.json
+  tmp=$(mktemp)
+  command sudo ruby <<EOF >$tmp
 require 'json'
 p = '/etc/transmission-daemon/settings.json'
 s = {
@@ -1568,8 +1569,10 @@ s = {
   "ratio-limit" => 5.0,
   "ratio-limit-enabled" => false,
 }
-puts(JSON.pretty_generate(JSON.parse(File.read(p)).merge()))
+puts(JSON.pretty_generate(JSON.parse(File.read(p)).merge(s)))
 EOF
+  cat $tmp | sudo dd of=/etc/transmission-daemon/settings.json
+
 fi
 
 ####### end transmission
@@ -1913,6 +1916,31 @@ EOF
       sysd-prom-fail-install $ser
     done
 
+    ## get upstream because it has the react ui, which has localtime, and general better usability.
+    ## begin get latest upstream prometheus ###
+    cd /a/opt/promdl
+    url=$(curl -s https://api.github.com/repos/prometheus/prometheus/releases/latest | jq -r '.assets[].browser_download_url | match(".*linux-amd64.tar.gz$").string')
+    f=${url##*/}
+    if [[ -e $f ]]; then
+      timestamp=$(stat -c %Y $f)
+    else
+      timestamp=0
+    fi
+    m wget -nv -N $url
+    new_timestamp=$(stat -c %Y $f)
+    if [[ $timestamp != $new_timestamp || ! -e /usr/local/bin/prometheus ]]; then
+      ngset
+      to_rm=( !($f) )
+      ngreset
+      if (( ${#to_rm[@]} )); then
+        rm -rf ${to_rm[@]}
+      fi
+      m ex $f
+      dir=${f%.tar.gz}
+      s install $dir/prometheus $dir/promtool /usr/local/bin
+    fi
+    ## end get latest upstream prometheus ###
+
     ;;
   *)
     pi prometheus-node-exporter