6416dd8731
If the Nextcloud container is recreated while the cronjob container is still running, the ID of the container is obtained each time the cron tasks are executed. Previously it was cached on entrypoint, so if the ID changed this container would fail.
15 lines
404 B
Bash
Executable file
15 lines
404 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
if [[ ! -z "$NEXTCLOUD_PROJECT_NAME" ]]; then
|
|
containerName="${NEXTCLOUD_PROJECT_NAME}_"
|
|
else
|
|
matchEnd=","
|
|
fi
|
|
|
|
containerName="${containerName}${NEXTCLOUD_CONTAINER_NAME}"
|
|
|
|
# Get the ID of the container so we can exec something in it later
|
|
docker ps --format '{{.Names}},{{.ID}}' | \
|
|
egrep "^${containerName}${matchEnd}" | \
|
|
awk '{split($0,a,","); print a[2]}'
|