---
title: 25.1.2 to 25.1.9 Troubleshooting Remote Agent Unavailable
slug: turbine-user-guide/2512-to-2519-troubleshooting-remote-agent-unavailable
docTags: 
createdAt: 2025-12-09T14:36:42.000Z
---

If a Remote Agents becomes unavailable, and the connections with TC are not reestablished until the Remote Agent container is restarted.&#x20;

**You can use the following to handle the below error:**

Add a new cron job with the user who runs the containers to restart automatically the remote agent when we detect the "Unexpected error occurred during agent heartbeat" error message.

**NOTE**: In case you would like to apply this script, you need to edit the script and change the "**AGENT\_CONTAINER\_NAME**" value

1. Open the script corresponding to the container technology you are using, **Docker** or **Podman**. (Scripts attached)

::Image[]{src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/8149313065/original/T9fqzZ5hqdIOjjQg_GI6QP7WHvkMQiplSA.png?1752507136" size="100" width="1978" height="688" isUploading="false" darkWidth="1978" darkHeight="688" showCaption="false" indent="1"}

:::Paragraph{indent="1"}
Edit the script > add the turbine agent name > Save
:::

:::Paragraph{indent="1"}
How to get the remote agent name? Run the following to list the containers running
:::

:::BlockQuote{indent="1"}
docker/podman ps
:::

::Image[]{src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/8149313064/original/gM3SKW5yiPotVOj5VuVn6WRpA_g6rY-v_w.png?1752507135" size="100" width="1978" height="177" isUploading="false" darkWidth="1978" darkHeight="177" showCaption="false" indent="1"}

2. Give execute permissions to the scripte.i (Change the file name to the correct script name)

:::BlockQuote{indent="1"}
chmod +rwx remote-agent-monitoring-(docker/podman).sh
:::

3. Edit crontab

:::BlockQuote{indent="1"}
crontab -e
:::

4. Add a cron job (Change the all path if it's necessary, and the script name)

:::BlockQuote{indent="1"}
\*/5 \* \* \* \* /home/\<user-name>/remote-agent-monitoring.sh >> /home/\<user-name>/remote-script.log 2>&1
:::

5. Save

:::BlockQuote{indent="1"}
\*press esc\* > \:wq
:::

**Code:**

**Docker script:**

:::BlockQuote
\#! /usr/bin/env bashDOCKER\_BIN=$(which docker)#DOCKER\_BIN="/usr/bin/cat"AGENT\_CONTAINER\_NAME="\<replace\_with\_your\_agent\_container\_name>"AGENT\_LOGS=$($ logs --tail 20 "$AGENT\_CONTAINER\_NAME" 2>&1 | grep "Unexpected error occurred during agent heartbeat")
\#AGENT\_LOGS=$(/usr/bin/cat logs.txt 2>&1 | grep "Unexpected error occurred during agent heartbeat")length=$(echo "$AGENT\_LOGS" | wc -l)
echo $length
if \[\[ ! -z "$" && $ -gt 5 ]]; then
&#x20; echo "- Restart Agent: $DOCKER\_BIN restart $AGENT\_CONTAINER\_NAME"
&#x20; AGENT\_RESTART=$($ restart "$AGENT\_CONTAINER\_NAME")
fi &#x20;
:::

**Podman script:**

:::BlockQuote
\#! /usr/bin/env bashPODMAN\_BIN=$(which podman)
\#PODMAN\_BIN="/usr/bin/cat"AGENT\_CONTAINER\_NAME="\<replace\_with\_your\_agent\_container\_name>"AGENT\_LOGS=$($ logs --tail 20 "$AGENT\_CONTAINER\_NAME" 2>&1 | grep "Unexpected error occurred during agent heartbeat")
\#AGENT\_LOGS=$(/usr/bin/cat logs.txt 2>&1 | grep "Unexpected error occurred during agent heartbeat")length=$(echo "$AGENT\_LOGS" | wc -l)echo $length
if \[\[ ! -z "$" && $ -gt 5 ]]; then
&#x20; echo "- Restart Agent: $PODMAN\_BIN restart $AGENT\_CONTAINER\_NAME"
&#x20; AGENT\_RESTART=$($ restart "$AGENT\_CONTAINER\_NAME")
fi &#x20;
:::
