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

Add docker commands to check if Fail2ban or CrowdSec containers are running #24

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

alvarosaavedrau
Copy link
Contributor

I have added Docker container commands to check if the Fail2ban or CrowdSec containers are running. The check is performed by inspecting the 'image' column.

# Check docker container running fail2ban
if docker ps -a | awk '{print $2}' | grep "fail2ban"; then
    IPS_INSTALLED=1
    docker ps | grep -q "fail2ban" && IPS_ACTIVE=1
fi
# Check docker container running crowdsec
if docker ps -a | awk '{print $2}' | grep "crowdsec"; then
    IPS_INSTALLED=1
    docker ps | grep -q "crowdsec" && IPS_ACTIVE=1
fi

Copy link
Owner

@vernu vernu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for catching that @alvarosaavedrau but, the changes don’t gracefully handle cases where docker is not available on the system.

@alvarosaavedrau
Copy link
Contributor Author

Completely agree, if docker is not installed it will fail. I have made a new commit to verify that docker is installed and running.
alvarosaavedrau@4acd58c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants