HackHome Posted September 15, 2023 Share Posted September 15, 2023 (edited) On 7/18/2023 at 1:13 PM, MrAndyBurns said: I have had a reoccurring issue where the container will just stop. logs says "send - failed to send 12 + 88 bytes in mode 0, code -1: Broken pipe" " *** buffer overflow detected ***: terminated\n","stream":"stdout","time":"2023-07-17T12:16:03.9714032Z" Got the same thing happen to my container like 1 or 2 times per month. Was to lazy (until now, see below) to get a workaround for that could be a shell script that once per day scrambles the docker log of the container and if the word terminated is found it restarts the container. Until now (if thats enough for your problem solving): I've setup an offline notification (within flightradar24.com click on "My datasharing" and "Show statistics" where you can find a little switch to turn on "OFFLINE EMAIL". At least this way I get noticed that my fr24feed needs a restart. Here is my shell script: #!/bin/bash # Define the name of your Docker container CONTAINER_NAME="FR24FEED" # Run the 'docker logs' command to fetch the container's logs LOGS=$(docker logs "$CONTAINER_NAME" 2>&1) # Define the regex pattern to search for SEARCH_PATTERN="terminated" # Use grep to search for the pattern in the logs if [[ $LOGS =~ $SEARCH_PATTERN ]]; then echo "The word 'terminated' was found in the logs." # Restart the Docker container echo "Restarting the container..." docker restart "$CONTAINER_NAME" # You can also add additional actions or notifications here if needed else echo "The word 'terminated' was not found in the logs." fi Don't forget to make it executable: chmod +x yourscript.sh That could be run nightly with cronjob (crontab -e) or more modern with systemd timers. Edited September 15, 2023 by HackHome Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.