Created
June 2, 2024 20:22
-
-
Save gvieira18/7fbee596cb2113a0765ac4a74ac8bab0 to your computer and use it in GitHub Desktop.
Ah shit, here we go again
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Name of the container | |
CONTAINER_NAME="" | |
# Command to run inside the container | |
COMMAND="cqlsh -e \"USE carepet\"" | |
# Run the command inside the container | |
docker exec -it "$CONTAINER_NAME" bash -c "$COMMAND" | |
EXIT_CODE=$? | |
# Print the exit code of the docker exec command | |
echo "The exit code of the docker exec command is: $EXIT_CODE" | |
# Optionally, handle the exit code | |
if [ $EXIT_CODE -ne 0 ]; then | |
echo "Command failed with exit code $EXIT_CODE" | |
# Perform any error handling or recovery here | |
else | |
echo "Command succeeded" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment