aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-05-11 12:57:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-05-11 12:57:57 +0200
commit5dc9c59b66b13c6a689174c1bb1b65dbf180af73 (patch)
tree9f47bef80632cd1b9b20fc55e585bf6b43db09c7
parent7e3f3d12dafe9232bd622456b272816ab21a12d7 (diff)
Start extra bbot-agent instance for priority monitoring
-rwxr-xr-xbuildos13
1 files 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 () # <toolchain-name> <toolchain-index>
#
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 () # <toolchain-name> <toolchain-index>
-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 () # <toolchain-name> <toolchain-index>
# 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"