make bbk account for cronjobs
authorIan Kelling <iank@fsf.org>
Wed, 15 May 2019 20:41:54 +0000 (16:41 -0400)
committerIan Kelling <iank@fsf.org>
Wed, 15 May 2019 20:41:54 +0000 (16:41 -0400)
brc

diff --git a/brc b/brc
index e740a8da51db5889095452dcd71db179e710ab0c..78d28e3b59370a4cdf6b6877e9cee7cae27796c1 100644 (file)
--- a/brc
+++ b/brc
@@ -342,9 +342,20 @@ b() {
 
 bbk() {
   c /
+  local active=true
+  if systemctl is-active btrbk.service; then
+    echo "cron btrbk is already running"
+    return 1
+  fi
+  systemctl is-active btrbk.timer || active=false
+  if $active; then
+    ser disable btrbk.timer
+  fi
   # run latest
   install-my-scripts
-  btrbk-run "$@"
+  if ! btrbk-run "$@" && $active; then
+    ser enable btrbk.timer
+  fi
 }
 
 bfg() { java -jar /a/opt/bfg-1.12.14.jar "$@"; }