You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: add full paths for grep commands in cron scripts
- Add GREP_BIN variable to both Docker run and Docker Compose scripts
- Use full paths for grep commands to handle cron environment limitations
- Update path discovery section to include grep binary location
- Ensure scripts work reliably in minimal cron PATH environment
Copy file name to clipboardExpand all lines: crowdsec-docs/unversioned/getting_started/installation/docker.mdx
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,9 +143,10 @@ For containers started with `docker run`, create this script:
143
143
144
144
CONTAINER_NAME="crowdsec" # Adjust to your container name
145
145
DOCKER_BIN="/usr/bin/docker" # Adjust path if needed
146
+
GREP_BIN="/usr/bin/grep" # Adjust path if needed
146
147
147
148
# Check if container is running
148
-
if ! $DOCKER_BIN ps --format "table {{.Names}}" | grep -q "^${CONTAINER_NAME}$"; then
149
+
if ! $DOCKER_BIN ps --format "table {{.Names}}" | $GREP_BIN -q "^${CONTAINER_NAME}$"; then
149
150
echo "Container ${CONTAINER_NAME} is not running"
150
151
exit 1
151
152
fi
@@ -173,9 +174,10 @@ For Docker Compose deployments, use this script instead:
173
174
174
175
cd /path/to/your/docker-compose/directory # Adjust path
175
176
DOCKER_BIN="/usr/bin/docker" # Adjust path if needed
177
+
GREP_BIN="/usr/bin/grep" # Adjust path if needed
176
178
177
179
# Check if service is running
178
-
if ! $DOCKER_BIN compose ps crowdsec | grep -q "Up"; then
180
+
if ! $DOCKER_BIN compose ps crowdsec | $GREP_BIN -q "Up"; then
179
181
echo "CrowdSec service is not running"
180
182
exit 1
181
183
fi
@@ -209,11 +211,15 @@ fi
209
211
:::tip
210
212
**Docker Compose is recommended** as it doesn't require knowing the exact container name and works with the service name from your `docker-compose.yml`.
0 commit comments