Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: server crashing if mysql connection is lost #20

Open
Joshua2504 opened this issue Jul 18, 2024 · 1 comment
Open

FIX: server crashing if mysql connection is lost #20

Joshua2504 opened this issue Jul 18, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Joshua2504
Copy link
Collaborator

No description provided.

@Joshua2504 Joshua2504 added the bug Something isn't working label Jul 18, 2024
@Joshua2504 Joshua2504 self-assigned this Jul 18, 2024
@Joshua2504
Copy link
Collaborator Author

Joshua2504 commented Aug 21, 2024

I implemented the following dirty script on server-side.

Let me know if you have any ideas...

crontab -e (replace <dir>)

*/1 * * * * <dir>/corforum/CoRT/check.sh 2>&1

check.sh (replace <dir>)

#!/bin/bash

# Define the URL to check
URL="https://cort.cor-forum.de"

# Send a GET request to the URL and capture the HTTP status code
HTTP_STATUS=$(curl -o /dev/null -s -w "%{http_code}\n" $URL)

# Check if the HTTP status code is 200
if [ "$HTTP_STATUS" -ne 200 ]; then
  echo "Site $URL is not reachable. Status code: $HTTP_STATUS"
  echo "Restarting Docker Compose services..."

  # Navigate to the Docker Compose directory
  cd <dir> /corforum/CoRT

  # Restart the Docker Compose services
  docker compose restart

  echo "Docker Compose services restarted."
else
  echo "Site $URL is reachable. Status code: $HTTP_STATUS"
fi

@Joshua2504 Joshua2504 changed the title server crashing if mysql connection is lost FIX: server crashing if mysql connection is lost Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants