From 5dc9c59b66b13c6a689174c1bb1b65dbf180af73 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 11 May 2023 12:57:57 +0200 Subject: Start extra bbot-agent instance for priority monitoring --- buildos | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/buildos b/buildos index 6a7bcfb..96cf209 100755 --- a/buildos +++ b/buildos @@ -893,7 +893,9 @@ function bbot_start () # # if [ "$b_word" = "configured" ]; then - for ((i=1; i <= ti; i++)); do + # Note: stop extra instance. + # + for ((i=1; i <= ti + 1; i++)); do if ! sudo systemctl stop "bbot-agent-$tn@$i"; then info "failed to stop bbot-agent-$tn@$i service, assuming not running" continue @@ -942,6 +944,7 @@ function bbot_start () # -e "s/^(Environment=TOOLCHAIN_NUM)=.*/\1=$tx/" \ -e "s/^(Environment=TOOLCHAIN_VER)=.*/\1=$tv/" \ -e "s/^(Environment=TOOLCHAIN_NAME)=.*/\1=$tn/" \ + -e "s/^(Environment=INSTANCE_MAX)=.*/\1=$ti/" \ -e "s/^(Nice)=.*/\1=$tc/" \ -e "s#^ExecStart=[^ ]+(.*)#ExecStart=$id/bin/bbot-agent\1#" \ "$id/lib/systemd/system/bbot-agent@.service" @@ -1019,8 +1022,10 @@ function bbot_start () # # the process has forked. Making sure the service has actually started is # done as part of the service monitoring. # + # Note: start extra instance. + # r=0 - for ((i=1; i <= ti; i++)); do + for ((i=1; i <= ti + 1; i++)); do if ! sudo systemctl start "bbot-agent-$tn@$i"; then info "failed to start bbot-agent-$tn@$i service instance" r=1 @@ -1195,7 +1200,9 @@ EOF # For each service instance check if it has failed. # - for ((i=1; i <= ti; i++)); do + # Note: check extra instance. + # + for ((i=1; i <= ti + 1; i++)); do if sudo systemctl is-failed --quiet "bbot-agent-$tn@$i"; then s="bbot-agent-$tn@$i service has failed, stopping" -- cgit v1.1